totalTime and MetadataReceived from VideoDisplay object in Flex
Interesting (and more than a bit annoying) observation; neither the property totalTime or the event MetadataEvent.METADATA_RECEIVED will trigger unless the buffer is full.
I just discovered this as I tried to dynamically set the bufferTime to be 30% of the total playtime (I calculate the bufferTime using totalBytes and bytesLoaded). But as I traced values like totalTime, I noticed it would stay at -1 until the video started playing (in other words; the buffer was full). Just for the sake of curiosity I set up an eventlistener listening for the duration property of the MetadataReceived event object. Interesting enough it wouldn’t trigger until the buffer was full.
It has been filed as a bug at Adobe’s Flex Bug and Issues Management System.
Possible workaround:
- set bufferTime to 0 at initialization (this would hopefully trigger the READY event (or MetadataReceived if you prefer)
- catch the totalTime value
- pause/stop the video
- increase bufferTime (or skip number 3 and go directly to number 4. It might work?)
Technorati Tags: flex, as3, actionscript, meta data, video, development
November 20th, 2008 at 12:58
thanks!
i think you have saved my day!
was so annoyed why the Metadata_RECEIVED event is not firing sometimes.