WP7 MediaElement Unable to Reposition the stream - windows-phone-7

I am using MediaElement for video playback in my app. I have added controls for play, pause, rewind and forward. In the forward button's event handler, I am trying to forward the video clip for 5 seconds. the code I have used to do that is given below.
if(myMediaElement.CanSeek)
{
myMediaElement.Position = TimeSpan.FromSeconds(2);
myMediaElement.Play();
}
But the video clip does not forward, instead it stops the video playback. Can anyone please tell me what is going wrong.

You need to start playing the stream before you can set the position.
Move the call to CanSeek and the setting of the position until after the MediaOpened event has been raised.
See the remarks in MSDN http://msdn.microsoft.com/en-us/library/system.windows.controls.mediaelement.position(v=VS.95).aspx for confirmation.

Using valueconverter sample here, with Slider adjustments, to get the positions
http://diggthedrazen.com/2011/07/08/using-an-ivalueconverter-to-create-a-player-with-a-seek-bar-on-windows-phone/

Related

How to stop sound and go back to idle animation on movement in ue4

so I'm making Emotes for my game and I need it so if the player moves at all it cancels the Animation and the Sound, does anyone know how to do this?
Here is my code in ThirdPersonCharacter for the emote:
I also need it so once the B key is pressed you can't press it again until you move. Without this you can spam the key and the sound goes crazy.
Thanks everyone!
P.S. The emote and sound loops, the sound is playing a cue
This can be done easily friend , you need to attach an audio component to your actor so that you have a reference to play it and stop it when your player starts to move or is standing idle, I recommend binding a function to where your player moves to stop the sound . The audio component has a stop function . You can also create a function to choose which sound should the audio component plays.
Now as for your second problem of sound going crazy a do once with delay node back to complete should do the trick , nonetheless there is also an input delay node which I forgot , YAAAAAAY time to learn new nodes!
I hope it helps . Keep on working :).
The issue here is that you're using the animations directly from the asset when, in fact, this is a perfect opportunity to use a Montage and blend the emote into the character.
If you detect movement input you can then cancel the whole thing. To stop the sound, you'll need to save a reference to the spawned SpawnSound2D in a variable. From there, a simple Stop node will do the trick. I'd probably leave the Montage running until it finishes to avoid unnatural character animations but if you truly need to stop the animation as well, use a Stop Anim Montage node
Be careful, though, sudden disruption of player feedback can feel clunky.

VLCJ EmbeddedMediaPlayerComponent player still shows old video image after preparing a new video

The following is the way I load a video (in the actual code, the variables are member variables of the player class). I do not want the video to be played right away which is the reason I use prepareMedia(). When the application is ready to play the video, I call player.play().
However, my player view (I add EmbeddedMediaPlayerComponent to JPanel which is set as ContentPane of a JFrame) still shows the old video after running the following code with a new "videoPath" value. The player view shows the new video only after I call player.play().
EmbeddedMediaPlayerComponent mediaPlayerComponent = new EmbeddedMediaPlayerComponent();
MediaPlayer player = mediaPlayerComponent.getMediaPlayer();
player.prepareMedia(videoPath);
Is there any way I can get the player to show the new video image (or at least removing the old video image) without starting to play it? I tried calling methods such as repaint() from mediaPlayerComponent, stop() from player, in the overrided MediaPlayerEventAdpater methods such as mediaFreed(), but nothing I tried so far work.
It is a feature of VLC/LibVLC that the final frame of the video is displayed when the video ends, so you have to find a workaround.
A good solution is to use a CardLayout with two views, one for the media player component (or the Canvas used for the video surface) and another view simply with a blank (black) JPanel.
The idea then is to listen for the video starting/stopping/finishing and show the appropriate view in your card layout.
If you add a MediaPlayerEventListener and implement the playing, stopped, finished and error events you should cover all cases.
For example: in the "playing" event you switch your card layout to show the video view, in the "stopped", "finished" and "error" events you switch your card layout to show the blank view.
The view doesn't have to be black of course, you can do whatever you want like show an image.
Also note that the media player events will NOT be delivered on the Swing Event Dispatch Thread, so you will need to use SwingUtilities#invokeLater to properly switch your view.

Cocoa video playback control delegates

I have a subclass of CAOpenGLLayer that is using, manipulating and displaying frames from an AVPlayer. I want to add playback controls to this layer, but I need to forward events from the playback controls to the AVPlayer. I have found a few examples of how to add familiar playback controls, like AVPlayerView, but all of them require me to pass in an actual movie file when what I want is just the interface that I can write custom delegates for. Any ideas?
There are currently no built in, ready to use, playback controls that you can attach your own targets and actions to. You'll need to roll out your own UI if you are rendering things by yourself.
If you are feeling sneaky though, you might be able to add your layer (in a view) to the AVPlayerView, remove the output that AVPlayerView adds from your player item, add your own video output, and let the AVPlayerLayer take control of the playback.

Switch Mediaelement control

I have one page which contains 2 Media Element Control, first I use one Media Element control to play video(play success) and then I use second Media Element control to play mp3 file but it's not play. I tried to set source = null, call function Stop() to stop first Media Element but Second Media Element is not play. Any body here can help me?. Thanks.
Multiple MediaElements do not seem to be supported, as documented here :-
http://msdn.microsoft.com/en-us/library/ff426928(VS.96).aspx
Hope this helps.
Paul Diston
Multiple MediaElements are not supported but you can use the XNA SoundEffect and the MediaElement.
Playing video and audio at the same time

MediaElement repeat play

I want to play a video file in mediaelement repeatedly, but when I try to play video again in the MediaEnded event MediaElement clears screen and screen is still clear for some little but appreciable time range. How to decrease this time range or dispose of it?
Thanks.
Could you provide the code for the MediaEnded-event? A bit looking for me resulted in this:
How to: Repeat Media Playback
Social.MSDN: Repeat MediaElement
Perhaps one of these approaches works better?
I also found out that this is a known issue in Silverlight (don't know if this also relates to the WP7 version): Looping with Silverlight media element - a small delay at end of clip before it plays
Hope this helps!

Resources