Copy link to clipboard
Copied
Hi,
I have an air destop project that displays local mp4 videos.
But Sometimes I want the video to play from a specific position for example 5seconds in.
Im just not getting anywhere trying to manipulate the the netstream.
I want to start an mp4 playing from a specific position.
so for example ive tried this...
stream.play(videoURL); | ||||||
stream.pause(); | ||||||
stream.seek(30); | ||||||
stream.resume(); |
This doesnt work though the playback just starts from 0 seconds like it normally would.
Any ideas?
Thanks
Copy link to clipboard
Copied
You can just specify the seconds to start at with play(),
e.g.:
stream.play('mp4:videos/myvideo.mp4',30);
Playing locally you still do need to make sure the file is loaded to that second before you seek to it. Seeking progressive without a media server will also only seek to keyframes. It's an expensive operation.
In normal seek mode, you cannot start the video at a point between the keyframes.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#seek()
Copy link to clipboard
Copied
ahh ok so how do I check to see if its loaded up to that second... and if it isnt how do I make?
Thanks
Aidan
Copy link to clipboard
Copied
AHH SORTED!
Listen to net_status for "NetStream.Buffer.Full"
Thanks for your help sinious.
Copy link to clipboard
Copied
You're welcome and just be careful that your buffer is at least 40 seconds in length, otherwise that event won't be as useful. It's pretty hard to know exactly the duration of audio loaded. You can request to play a specific second in which Flash will wait until it's loaded and then begin playback. You'll get a playback event at that point when playback begins. Until you receive the event that playback has started you can just display some kind of "loading" message to the user.
Glad you got it resolve. Good luck!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now