You could also signal from the server that the end of the stream has
been reached through
a call back to the client.
Although from FMS you would have to write a little bit of code (not
too dramatic) to help
this via a server callback.
Hope that option 6 helps...
Samuel
On Sep 23, 2008, at 6:15 PM, Jonathon Stierman wrote:
Anyone know how to detect when the end of a streaming video has been
reached using the three basic classes: Video, NetStream or
NetConnection?
Here are the approaches I’m aware of:
1. Listen on the NetStream for the NetStream.Play.Stop status event.
Problem here is that this doesn’t seem to signify that the end of
the video has been rendered. Only that the final bytes of the
NetStream have been delivered to the client. On my streaming test,
this event fires well before the Video instance has actually
finished playing the stream.
2. Adding cue points to the end of the video, and monitoring for
those.
Could work, but very annoying to have to go through all the videos
and add cue points for what should be a trivial problem.
3. Grabbing the duration out of the metadata and starting a timer.
Also could work. Would need to be extra careful once playback
controls are added to make sure the timer is actually firing when
the video’s last frame completes. Since the metadata varies
from .flv to .flv, I really do not want to rely on this. All of the
movies I have seen do specify the duration, but I’m reluctant to
rely on this method.
4. Use the VideoPlayer class.
If I can’t find a good solution besides this one, it will have to
do. I’ll have to do some work to add in the features I had added
into my current setup, but it would be better than not being able to
accurately detect the end of a video.
5. Compare the Netstream’s bytesLoaded to it’s bytesTotal
In my test, bytesLoaded never differs from bytesTotal through the
life of the video. It always displays the same number.
This seems like such a simple problem to solve, but after looking
through those three classes, I do not see any events or byte counts
that I could use to react to. Hopefully I am just missing something
– it seems quite odd to me that this wouldn’t be included
functionality in the Video class.
TIA
Jonathon