2 Replies Latest reply on Dec 5, 2007 2:37 PM by jordan.sun

    Using VideoDisplay to play FLVs with incorrect duration metada values

      I use Episode Pro 4.4 to encode FLV's from WMV, and occasionally mpgs as well. A significant number of these videos have an incorrect duration metadata value (reported as shorter than the actual), and when I play them back using VideoDisplay, the video appears to try to seek beyond the seekbar (which I have created using an HSlider), and plays the last fraction of a second of the video over and over, or autorewinds. If I remove the HSlider, the video plays normally.

      The basics of the player is a VideoDisplay component, and an HSlider. The HSlider's maximum value is set to VideoDisplay.totalTime, and its "change" event is handled by a function that sets the video playhead based on the position of the HSlider's seeker.

      My question is, is there anything extra I should check for to make sure the video doesn't play like a broken record for the last fraction of a second (or autorewind when it isn't programmed to)? It seems like there ought to be some way and I am missing something, because the videos play fine in Flash CS3's FLVPlayback component.
        • 1. Re: Using VideoDisplay to play FLVs with incorrect duration metada values
          rfrishbe Level 3
          Hey Jordan,

          It's hard to diagnose this (code might help and access to the bad flv file). I'm curious how the HSlider plays into this? If you take that out do you still see the same behavior? Also, if you know the totalTime of the video, you can update totalTime (as it's read/write) and see if that helps.

          • 2. Re: Using VideoDisplay to play FLVs with incorrect duration metada values
            jordan.sun Level 1
            Here's the code:


            <?xml version="1.0" encoding="utf-8"?>
            xmlns:mx=" http://www.adobe.com/2006/mxml"
            import mx.controls.VideoDisplay;

            private function play():void{
            videoDisplay.source= flvUrl.text;

            private function stop():void{

            //Change event function for the HSlider
            private function change(video:VideoDisplay, slider:HSlider):void{
            //If the playhead doesn't exceed the maximum slider value
            if (video.playheadTime <= slider.maximum){
            video.playheadTime = slider.value;
            //otherwise if it does (Episode Pro error)
            else {
            //slider.maximum = video.playheadTime + 1;
            //video.playheadTime = slider.value;

            <mx:VideoDisplay id="videoDisplay"
            width="480" height="360"
            playheadUpdateInterval="1" />

            minimum="0" maximum="{videoDisplay.totalTime}"
            change="change(videoDisplay, seekbar)" thumbRelease="change(videoDisplay, seekbar)"/>

            <mx:TextInput id="flvUrl" width="302" text=""/>
            <mx:Button x="535" y="472" label="Play" click="play()"/>
            <mx:Button x="594" y="472" label="Stop" click="stop()"/>



            The main thing that is giving me trouble is the HSlider, and the change() function associated with it. Without the change() function for the HSlider, the video plays fine. The change() function I pasted above actually partially solves the issue, though it is a bit of a hack, and an occasional video does still play oddly (they loop endlessly). The original change function was:


            private function change(video:VideoDisplay, slider:HSlider):void{
            video.playheadTime = slider.value;

            I'll look into getting an FLV if it will help, most of them are pretty big so I was unable to get one today.