I am creating a player using MediaUriElement. where i have a list of titles to play
which is a mix of both Image and Video. content will change in List Box selection change event.
i am using VisualBrush to replicate the video by filling to a rectangle in the same window for a mirror effect.
While running the application video and image plays good after some one hour there is a
delay in shifting from video to image. ie, if i select the next item in ListBox to play
then there is a delay like whole application hangs till the currently running video completes, then the selection change happens and the next title is playing in the player.
I don't know any particular reason for being like this.
Please help
Related
I have built a Windows Phone application with a video player to show a logo animation at startup.
If I launch an external application (like Spotify) with background audio (for example a song) and then switch to my application, the song is stopped (probably because of my logo animation) even though my logo animation doesn't even have audio.
I used a MediaElement for the logo animation :
<MediaElement AutoPlay="False" Name="media" Source="Assets/video.mp4"/>
In the code behind I use media.play(); to start the logo animation.
Is there a way to avoid stopping the sound of other applications?
From the MSDN:
When a MediaElement control plays audio or video content, any
background sounds or media already playing are halted. The app
launches the playback experience when the user taps the control. Only
one MediaElement control can operate at a time.
What this means for you is that you need to redesign the logo to run via XAML animations or some other means besides MediaElement if you want background audio to function properly. Depending on where your animation is coming from, this might be simple for you or it might be outside your scope. You'll have to determine for yourself if the benefits of background audio (Pandora, Spotify, Podcasts, etc) outweighs the work required.
That being said, I've used a large number (probably 20% in my testing) of apps that cancel background audio every time you enter them, and it's extremely frustrating. I think most users would prefer you fixed your application so that background audio is not interrupted.
I have a C# Windows Form application that plays local videos. I would like to overlay a small form with controls over the video while it is playing. The video is owned by a panel and I have tried to create another panel that contains controls like a button and textbox and tried to brind the whole panel forward and send the video back, but the video stays on top.
Any ideas?
You typically cannot place controls on top of video without having flickers and unwanted artifacts. This comes from the fact that video playback allocates specific video hardware resources to stream video and streaming takes place separately from the rest of UI. Applications such as players "mix" overlay images (including those which mimic controls) into video or otherwise display them through specialized APIs, those are not regular controls.
The easiest solution for you is to place controls side by side to the video, without putting one on top of the other.
I imported a axWindowsMediaPlayer control to my form to play a sequence of pictures and/or small videos.
Now I want the user to adjust the slide show to his own needs, so he should be able to select the "showtime" of each picture and just play the video's length.
I tried to apply a timer to the form, and change the axWindowsMediaPlayer URL every "x" amount of seconds. This works perfectly for pictures, but videos now have an extra blank screen or footage cut off (depends on the time of the video compared to the "x" amount of seconds).
I want to to use an event, which will trigger when the media has stopped playing(so it wont cut off video's), but when I searched trough the axWindowsMediaPlayer event's list, I only found onMediaChanged. This event is kinda strange, it triggers a few times on the beginning of a video and at the end...
Is there anyway I can solve this? Maby using something different than the axWindowsMediaPlayer?
I found the solution after google'ing for hours. If anyone wants to know how to acces the axWindowsMediaPlayer's duration:
axWindowsMediaPlayer1.currentMedia.duration
It's a property (get and set) so this is all I needed.
I have a requirement to play a video file in C# (with audio) then to be able to fade out the video to a black screen then fade in another video.
I've looked at DirectShow & DirectShowNet however I'm none the wiser. I've got a simple app to play a video with a time counter etc, however I'm flummoxed with filters & graphs.
What direction do I need to go in?
Create a WPF Apllication and use the MediaElement Control to play the videos. Use the events of the MediaElement (for example MediaEnded) to detect when to start fadeout / switch streaming source / fadein. The easiest way for the fadeout is to change opacity of the Mediaelement.
The MediaElement should be able to play all videos which have a directshow filter installed on your system.
Are you using WPF?
With WPF you could do this in a variety of ways. eg you could simply animate the video control's (MediaElement) opacity.
NOTE: you can use WPF controls inside of a Winforms app. See this video for how to do this.
One solution, although I would consider it a hack, would be to draw a black overlay ontop of the viewable area of the video. You can adjust the transparency of the overlay based on the frame/time of the video. Essentially, you would fire off a timed event that would slowly remove or add transparency to the overlay based on where in the video you want to starting fading.
I am looking for a solution for a question that was already posted but did not answer correctly, thanks in advance.
Show first frame of video in WPF MediaElement
The solution in the other thread should work but you could approach it differently.
Basically, to avoid having to load the video just to grab the first frame you could generate a static image that is the frame you want to show. If you are encoding the video most encoding software will generate a thumbnail for you for this purpose. If not you can screen shot a frame and use that
Then display that image in a normal WPF image control when the movie is not playing. When the user plays the video use a trigger to hide the image and show the video.
This will give you the effect you want.
Downside: This static image will get out of sync with the video if your video file is updated (you would need to regenerate the thumbnail in this case)