Silverlight - Play MediaElement at a time in a Storboard - silverlight

I have a MediaElement that should be played at a certain point during a Storyboard (say 0.5 seconds in). Is it possible to kick off MediaElements at any particular point in a Storyboard? The Storyboard is set to repeat forever, so it should fire every time the marker reaches a certain time.

Related

WPF MediaElement video won't play after being hidden in storyboard

I'll start of by describing the problem, and then follow up with details about the process I'm going though.
Problem:
I'm having an issue where I'm playing a MediaElement on one storyboard and then setting the same MediaElement to hidden in another. After having the MediaElement set to hidden, I'm unable to replay the video portion of that storyboard again (non-MediaElement animations still happen.) Videos are WMVs encoded in VC-1 at 10,000 Kbps at a resolution of 1560x1004 and provided alongside the project as relative assets.
Details:
I'm working on a Kiosk application which makes use of a large number of videos combined with some graphical effects for real-time animation. Presently I'm creating storyboards using Blend, layering the videos for playback in the desired sequence. Below details two sample storyboard from the page:
Open performs the following:
Set's meOpen's visibility to 100%, Visible
Set's meIn's visibility to Hidden at 1 second (masking the start of meOpen)
Starts playing meOpen at 0:00.900.
Before playing the Close storyboard the Open storyboard is played, and the system waits for user input to continue. Once Close is triggered, the following happens:
meOpen - A MediaElement that has it's visibility set to 'Hidden' at 1 second
meClose - A MediaElement that is the desired video to play. I have it starting slightly before meOpen is hidden to mask the first frame 'black frame' while the element is loading the video
The rest of the items is just fading visibility of overlay elements.
The storyboard works for running through the video; however, if I try and play the Open storyboard a second time, meOpen does not play.
Thanks

Change image source every n seconds wp7

I need to chage image on windows phone 7 app every 25ms. This animation should start after button pressed and play for 10 seconds. Is there any way to do it in wp7?
on the button click event you could create a timer object and start it, then on the timers tick event you check to see whether the current millisecond reading on the timer is divisible by exactly 25 (use the modulo operator) if it is you can then run the code that will change the image source property, and in the same tick event handler you can set a check for if the second reading is 10 seconds, and if it is stop the timer

Windows Phone 7 - Playing a specific portion of sound using MediaElement

I'm trying to play a specific portion of a mp3 file using MediaElement. I understand that I can use the Position property to move to a specific time in the sound and start playing from there. But I would also like to restrict the duration when it plays. For example if a given mp3 file is 30 seconds long, i would specifically like to play the sound from 5th second to 10th second and want the playing to stop.
I thought about using a separate background thread or a timer callback that will measure the time and then wakeup to stop the mediaelement. But I was wondering if the MediaElement itself supports one such a way to specify the duration of the time to play.
You can set Markers. Once a Marker is reached, the MarkerReached event is fired and you can stop the sound MediaElement there.

Smooth Video Transitions for WPF

I'm using VB.net 2010 and WPF 4. I need to have a smooth transition between two videos played on the mediaelement. I absolutely cannot use anything that requires me to use a winhost in the WPF window, as that will make my project impossible (since the video is full screen, and the controls are over the video)
Basically, I need for the video to play through, and then smoothly go to another video specified in code behind. I cannot splice the two videos together - they must be separate.
How do I have the videos transition smoothly, with no "blink"?
I'm guessing without testing here. You're probably going to need some CPU cores and a good video card.
If you have the memory, use two MediaElements.
Queue up both videos, one on each element.
Set the opacity of the second one to completely transparent. They're UIElements so this should work...
Use timers of some kind keyed from the start of playback on the first one so that you get an event a couple of seconds before playback ends.
With that event delegate, start the video in the second MediaElement, animate the first one's opacity to zero while simultaneously animating the second one to fully opaque.
If you need to do it again, set up the timer again and make sure your delegate animates things the other way.

How to seek a WPF Storyboard to a specific frame/time offset when not running

I wish to seek to a specific time or frame using the ClockController.SeekAlignedToLastTick - however this does not appear to do anything, unless the Storyboard is running.
I dont want to have to 'start' the storyboard, because I only intend the Storyboard to set all dependencyproperty values, and have everything lay-out for that time position, so that I can take a snapshot and advance to the next frame (I could respond to clock events and capture the frame, but then I couldnt guarantee I would get my snapshots at the correct times that I want).
How can I simply advance a WPF storyboard to a specific position without 'running' it?
Thanks!
You'll have to at least begin the animation before you can seek into it. You can however begin then pause right away, and seek.
// sb is a Storyboard
sb.Begin();
sb.Pause();
sb.SeekAlignedToLastTick(sometimespan);

Resources