Playheadtime and totalTime

OK i am really stuck, I have a flv file in flash I am using
the FLV Custom Component. I need to be able to display the running
and total time of the video in two seperat text field on the scene.
I can't seem to get this to work. My video is a converted flash swf
file to QuickTime then I creat a FLV file from the flash video
encoder. Please help

There is probably a better way but this should give some
idea:
/// Assume 2 textfields tf1 and tf2 are on the timeline
// and FLV compoent is named: flc
this.onEnterFrame = updateTime;
function updateTime():Void {
tf1.text = flc.totalTime;
tf2.text = flc.playheadTime;
The textfields may display "undefined" for a second, until
the metadata for the FLV has loaded and the video has started.
HTH.
Tim

Similar Messages

  • FLVPlayBack and TotalTime

    I recently upgraded from Flash MX to CS3. I am using the
    FLVPlayback component to play some video. I am trying to get the
    slider to work. In MX, (and the documentation for CS3 tells you to
    do the same) you would set the Component Parameter of totalTime to
    get the slider to work. But, when I open the component inspector
    there is no parameter for totalTime listed there. I have done this
    hundreds of times in MX and have had no problem, but I can’t
    figure it out in CS3.

    set the publish setting to AS2, then drag the component on
    stage, it will be the familiar component.

  • Trying to include a timer in FLVPlayback

    I'm trying to include a simple time elapsed/time remaining
    display on a video that's playing back from a local disc (so I
    can't use netstream) and can only find examples of how to do it
    with AS2. Anyone have any ideas?

    you can use the playheadUpdate event to check the
    playheadTime and totalTime.

  • VideoPlayer complete event firing early

    I'm not sure why this is happening, but for some reason the complete event is firing about 5-10 seconds into my minutes long video.
    Here is the code for the VideoPage that loads the video and listens for the events. Does anything seem off to anyone?
    package com.applied.flex.pages
         import com.applied.flex.events.PageEvent;
         import flash.events.ProgressEvent;
         import spark.components.VideoPlayer;
         import spark.events.VideoEvent;
         public class VideoPage extends BasePage
              private var _video:VideoPlayer;
              private var _startTime:uint = 0;
              private var _endTime:uint;
              private var _cuePoints:Array;
              private var _displayedPoints:Array;
              private var resetting:Boolean = false;
              private var seekSafe:Boolean = true;
              public var readyToStart:Boolean = false;
              public function VideoPage(xml:XML,majorType:String,minorType:String,path:String)
                   super(xml,majorType,minorType,path);
                   _video = new VideoPlayer();
                   if(xml..Video[0].@StartTime != undefined)
                        _startTime = xml..Video[0].@StartTime;
                   if(xml..Video[0].@EndTime != undefined)
                        _endTime = xml..Video[0].@EndTime;
                   _cuePoints = new Array();
                   for each(var i:XML in _pageXML.Video.CuePoints.children())
                        _cuePoints.push(i.@OnTime);
                   _video.addEventListener(VideoEvent.READY,doVideoReady);
                   _video.source = path;
                   this.addChild(_video);
              private function doVideoReady(e:VideoEvent):void
                   _video.removeEventListener(VideoEvent.METADATA_RECEIVED,doVideoReady);
                   if(_pageXML..Video[0].@EndTime == undefined)
                        _endTime = _video.totalTime;
                   readyToStart = true;
                   this.dispatchEvent(new PageEvent(PageEvent.READY_TO_START,false,false,0,this));
              public override function startPage():void
                   addListeners();
                   _video.seek(_startTime);
              public override function resumePage():void
                   addListeners();
                   _video.play();
              public override function pausePage():void
                   removeListeners();
                   _video.pause();
              public override function stopPage():void
                   removeListeners();
                   var ar:Boolean = _video.autoRewind;
                   _video.autoRewind = true;
                   _video.stop();
                   _video.autoRewind = ar;
              public function seekPage(seekTo:Number):void
                   if(seekSafe)
                        removeListeners();
                        _video.pause();
                        _video.addEventListener(VideoEvent.PLAYHEAD_UPDATE,doSeekSafe);
                        _video.seek(seekTo);
                        seekSafe = false;
              private function doSeekSafe():void
                   _video.removeEventListener(VideoEvent.PLAYHEAD_UPDATE,doSeekSafe);
                   addListeners();
                   _video.dispatchEvent(new VideoEvent(VideoEvent.PLAYHEAD_UPDATE));
                   seekSafe = true;
              private function addListeners():void
                   _video.addEventListener(VideoEvent.COMPLETE,dispatchPageComplete);
                   _video.addEventListener(VideoEvent.PLAYHEAD_UPDATE,doVidProgress);
              private function removeListeners():void
                   _video.removeEventListener(VideoEvent.COMPLETE,dispatchPageComplete);
                   _video.removeEventListener(VideoEvent.PLAYHEAD_UPDATE,doVidProgress);
              private function doVidProgress(e:VideoEvent):void
                   var scrubObj:Object = new Object();
                   scrubObj.currentTime = (e.currentTarget as VideoPlayer).playheadTime;
                   scrubObj.totalTime = _endTime - _startTime;
                   trace("playheadTime | "+e.currentTarget.playheadTime);
                   trace("end time | "+_endTime);
                   dispatchUpdateScrubber(scrubObj);
                   checkForCuePoint(e);
                   if(_video.playheadTime >= _endTime)
                        dispatchPageComplete();
              private function checkForCuePoint(e:VideoEvent):void
                   if(_cuePoints.length > 0)
                        if( (e.currentTarget as VideoPlayer).playheadTime > _cuePoints[0].toString() && !resetting )
                             var item:Object = new Object();
                             item.point = _pageXML..CuePoints[_displayedPoints.length].toString()+"<br><br>";
                             dispatchUpdateScrubber(item);
                             _displayedPoints.push(_cuePoints.shift());                         

    Not sure if you found an answer to your problem, but I have come across this a few times, and I eventually found that is was a "corrupted" FLV.  It seems as though at a given point in the encoding process, there is a little "skip".  This skip causes the COMPLETE event to fire when there might be a good amount of video left in the file.  Try making the FLV in a different encoding program and see if you still have your problem.

  • MediaPlayback component intermittent stuttering

    I'm creating a very simple .mp3 player in Flash 8. When the
    user selects one of four audio files, I set the contentPath of the
    component instance to the .mp3's filepath. There's also a button
    that plays/pauses the .mp3 using the myInstance.play() and
    myInstance.pause() commands. For the most part, it works fine.
    However, sometimes when the user pauses the .mp3, then
    selects a different .mp3, the audio begins to stutter repeatedly;
    it plays a very short (less than one second) snippet of the audio,
    then keeps repeating this snippet.
    Anyone ever encountered this? Thanks!

    Marghoob Sulemaan suggest a better solution I just dont know
    if flvPlayBack offer a video listener like onVideoComplete. if
    youfind this solution plz let me know
    other option:
    you can execute this script while the video is playing. you
    can probablly execute it every 1 second by setting set interval:
    script:
    var m = this.myVideo;
    if(!m.playing)
    if(m.playheadTime) >= m.totalTime){
    trace("video ends! play the next one")
    }

  • How to customize video player progress bar?

    I want a video progress bar (maybe it is a slider ), which
    can be used to show the buffer progress of video, the standard
    slider control in Flex has not this function.
    How can I customize the silder control?

    this is a very basic video player. what we've done here is A
    LOT of binding i.e. vp.playheadTime=(vp.totalTime/(100/ctr.value))
    after you've figured out what the right math is..which is
    already done here, you can just skin it and it'll work fine. i
    haven't had the time to update this for a while but there is
    definitely room for improvement. hope this helps.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    horizontalAlign="center" verticalAlign="middle"
    horizontalScrollPolicy="off" verticalScrollPolicy="off"
    width="100%" height="100%">
    <mx:Script>
    <![CDATA[
    public function init(path:String):void
    vp.source = path;
    vp.play();
    public function fixIt(what:Number):Number
    what.toFixed(2);
    return Number(what);
    ]]>
    </mx:Script>
    <mx:VideoDisplay autoPlay="false" id="vp"/>
    <mx:HSlider minimum="0" maximum="100" width="{vp.width}"
    height="29" id="ctr"
    value="{fixIt(vp.playheadTime/(vp.totalTime/100))}"
    change="vp.playheadTime=(vp.totalTime/(100/ctr.value))"
    liveDragging="true"/>
    <mx:Label id="duration"
    text="{int(vp.playheadTime)}"/>
    <mx:HBox>
    <mx:Button id="pp" label="Play/Pause"
    click="if(!vp.playing){vp.play()}else{vp.pause()}"/>
    <mx:Button id="st" label="Stop" click="vp.stop()" />
    <mx:Button id="rw" label="Rewind"
    click="vp.playheadTime=0" />
    </mx:HBox>
    </mx:VBox>

  • Progress Bar for Video

    Hey,
    I'm new to Flex and ActionScript and I have little Problem
    implementing a ProgressBar for an Video.
    It just doesn't work, no matter what i try!
    Here is some of the Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
    xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical"
    width="100%"
    height="100%" creationComplete="init()">
    <mx:Panel
    width="100%"
    height="100%"
    layout="vertical"
    id="p"
    title="Videofenster">
    <mx:VideoDisplay
    width="100%"
    height="100%"
    id="vid"
    source="guitar.flv"
    autoPlay="false"/>
    <mx:Canvas
    width="100%"
    height="79">
    <mx:Button
    id="playButton"
    click="vid.play()"
    label="Play"
    x="192"
    y="10"/>
    <mx:ProgressBar
    x="389"
    y="10"
    label=""
    id="progress"
    mode="manual"
    minimum="0"
    maximum="100"/>
    <mx:Script>
    <![CDATA[
    import mx.events.VideoEvent;
    private function init():void
    this.addEventListener(VideoEvent, showProgress);
    private function showProgress(event:Event):void{
    progress.setProgress(vid.playheadTime, vid.totalTime);
    ]]>
    </mx:Script>
    </mx:Canvas>
    </mx:Panel>
    </mx:Application>
    It looks like the method showProgress is never called,
    meaning the VideoEvent didn't raise. How is this possible, where is
    my fault? Any suggestions?
    I worked around this Problem, with a Button calling the
    sameMethod. This brings me to the next problem. Although, i can
    call the method by the Button, the progressBar ist still not
    acting!
    Every help is appreciated!
    Text

    I can't really answer you first question. What has happened is: when I moved an mpg file from my assets to the movie (I have added already a mpg file in the first part of the movie) a message box appears telling me the file is being "indexed" and then this Indexing progress appears in lower right of screen and it processes up to 99% and then freezes. The file appears in the time line, but the frame appears that says "media pending" and then nothing happens. I can go into the Widows media player and the mpg file plays okay, with audio. That is best I can tell you.
    Though I did not say this earlier, when I try to open this mpg file from the Organizer, Premiere does not open.
    My operating system is Windows 7 on a Dell computer with lots of ram and plenty of space on my hard drive.
    Properties of movie file
    These properties are the same as a file I already inserted in the timeline.
    I look forward to your help and thanks..
    JC

  • Determining the current frame/time of video

    I'm using AS2 and would like to create a function to monitor
    the current
    time of an FLV file in a swf. I'm using the swf in Director
    and using the
    format sprite (1).flvCode.flvPlay () where sprite (1) is the
    location of the
    swf, my AS2 code is in a movieClip with an instance name of
    flvCode and I
    have a function (just or illustration purposes) of flvPlay ()
    I'v looked in the AS2 reference but it's strangely absent of
    code that would
    provide the current flv time or even the duration of the flv.
    Craig

    Thanks. I'm too much of a novice to even realize that I was
    asking the same
    question.
    "Rothrock" <[email protected]> wrote in
    message
    news:g4dqhr$58e$[email protected]..
    > Like David told you in your other thread you need to
    look under the
    > class(es)
    > that you are using. Are you using the FLV playback
    component? In that case
    > you
    > need to look in the Components Language Reference.
    >
    > From there scroll down to FLBPlayback Component.
    >
    > In there the FLVPlayback Class will have a listing of
    everything that is
    > available.
    >
    > I'm thinking that FLVPlayback.playheadTime and
    FLVPlayback.totalTime are
    > probably what you want.
    >
    > If you aren't using the playback component then you most
    likely need to
    > look
    > at the ActionScript 2.0 language reference under the
    NetStream Class. In
    > that
    > case you will need the onMetaData event to capture the
    total time for the
    > FLV
    > when it loads and the time property to check the current
    position.
    >
    > So I don't know where you were looking, but there is
    plenty of code to
    > help
    > you along.
    >

  • Flv counter

    Hi there,
    The basics of it are - I'm trying to come up with a way to
    start/stop a timer when a cue point is hit. like a start stop on a
    stopwatch. Its for a piece of race footage where the lap starts
    some time through the flv.
    Now more in depth - I want the timer to be a dynamic text box
    that when you scrub back and forth on the flv playhead
    the timer responds acordingly as if it were the flv timecode.
    Now there are 2 ways I can see this going. First to write a large
    lump of code and design a custom timer, or offset the flvs time in
    actionscript so that when it hits the first cue point it has
    reached 0 and the cue point would tell the alpha of the dynamic
    text box to change from 0% to 100% (so it looks like it has started
    on the cue point)..
    Which is easier and how would I go about writting the action
    script for it.
    I know this is a big project, but im hoping that there is a
    way to offset as I think this might be a quicker option.
    Thanks in advance for anyone who would know how to tackle
    this.

    Are you using the FLVPlayback component? If so, I'd probably
    use the offset approach you mentioned.
    If you use the cuepoint to trigger the start of your timer,
    consider that it will never happen if someone scrubs into the
    'timer' range from outside.....so you may need to set it up as a
    listener for the whole video in the playheadUpdate event.
    If you use the cuepoint approach, once the cuepoint triggers,
    you know the playheadTime from the cuepoint event data already (or
    you can check it as playheadTime) and set this as your 'zero' time
    and fade in your textfield or whatever. You may want the listener
    even set up without the cuepoint... if they scrub over the cue
    point and arrive in the "timer" range somewhere, the cuepoint never
    fired and so the timer doesn't show. Or you could do it the same
    way using the playheadUpdate and a check for proximity to the
    'zero' time (which you have hard coded) to start the fade in.
    Whether its set up by the cuepoint, or you set it up for the
    whole video, you just need to set up a listener for playheadUpdate
    event (change the playheadUpdateInterval if you want it to be more
    frequent than 0.1 secs - its probably OK as is for what you want).
    In the listener, first check that the playheadTime is within
    the range that you want it to be visible. If its not then I'd make
    the text field instantly not visible (you could fade it out if it
    was close to the time when it would normally fade while "playing"
    ,but if its scrubbed out of the 'timer' range then probably you
    want it to be instantly gone rather than fade...? ) .
    If its in range, then you could check and see if the
    textfields _visible property is false (which may be the case if it
    was scrubbed into the middle of the timer range from outside ) and
    if so make it true. And then assign it the value of the current
    playheadTime minus the 'zero' playheadTime like you described.

  • NetStream

    Hello!
    I try to make a video player using NetStream, NetConnection
    and Video all from flash.
    My problem is that I don't know how to get totalTime for a
    video, can anybody help me with that? I work with Flex 2.
    I use that for the initialization for NetStream,
    NetConnectionand Video:
    _netConnection = new NetConnection();
    _netConnection.connect (null);
    _netStream = new NetStream(_netConnection);
    _video = new Video();
    addChild (_video);
    _client = new Object();
    _netStream.client = _client;
    _client.onMetaData = onNetStreamMetaDataCallback;
    _video.attachNetStream (_netStream);
    This is for metadata, this suppose to give me the information
    about the video and totalTime, but I put a breakpoint here and
    never stop wit debug:
    private function onNetStreamMetaDataCallback
    (mdata:Object):void
    trace (mdata.duration);
    The path for video is a local path, a video file flv in my
    project:
    _netSTream.play("video/phone.flv");

    My NetStream Video instance spans 200 frames in the
    timeline.

  • NetStream video total time

    Hello!
    I try to make a video player using NetStream, NetConnection
    and Video all from flash.
    My problem is that I don't know how to get totalTime for a
    video, can anybody help me with that? I work with Flex 2.
    I use that for the initialization for NetStream,
    NetConnectionand Video:
    _netConnection = new NetConnection();
    _netConnection.connect (null);
    _netStream = new NetStream(_netConnection);
    _video = new Video();
    addChild (_video);
    _client = new Object();
    _netStream.client = _client;
    _client.onMetaData = onNetStreamMetaDataCallback;
    _video.attachNetStream (_netStream);
    This is for metadata, this suppose to give me the information
    about the video and totalTime, but I put a breakpoint here and
    never stop wit debug:
    private function onNetStreamMetaDataCallback
    (mdata:Object):void
    trace (mdata.duration);
    The path for video is a local path, a video file flv in my
    project:
    _netSTream.play("video/phone.flv");

    Hi,
    There is function in the NetStream to check it out the status
    and the Informations embeded in all the FLV.
    To find out the Infromations of the videos
    you can use this functions.......
    NetStream.onMetaDeta = function();
    To find out the status of the playng video.
    You can use this function...
    NetStream.onStatus = function()

  • How to add [playheadtime / totaltime] to FLVPlayback skin

    I need to add [playheadtime / totaltime] to my FLVPlayback
    skin so that I can see it while the video is in fullscreen mode.
    Thanks in Advance,
    Siraj R Khan
    [email protected]

    Answer: You can add your movieClip or button to FLVPlayBack
    component, like i did.
    uFlvPlayer.addChild(PlayTime_txt);
    It works in FullScreen mode now.

  • Seek and flvPlayback - what's wrong with this please?

    Hi,
    I'm trying to build a player where there's a button that pause the video and then moves the video forward by one second. I am using the following:
    flvPlayback.pause();           
    var newTime = flvPlayback.playheadTime + 1;          
    var currentTime = timeToString(newTime);           
    var endTime = timeToString(flvPlayback.totalTime);         
    progressLabel.text =  currentTime + " / " + endTime;           
    percentLabel.text = Math.round(currentTime/endTime) + "%";           
    flvPlayback.seek(newTime);
    This works for the progressLabel and percentLabel but the video itself does not move to the specified point. Only when I hit play does the video scrub to the right point - can someone help please?

    Thanks for that - but is there anyway to have the player paused instead of playing automatically?
    I tried to use this (where pausePlayback is just a flvPlayback.pause function) but it didn't work:
                flvPlayback.pause();
                var newTime = flvPlayback.playheadTime + 1;
                var currentTime = timeToString(newTime);
                var endTime = timeToString(flvPlayback.totalTime);
                progressLabel.text =  currentTime + " / " + endTime; percentLabel.text = Math.round(currentTime/endTime) + "%";
                flvPlayback.seek(newTime);
                var timer:Timer = new Timer(40, 1);
                timer.addEventListener(TimerEvent.TIMER_COMPLETE, pausePlayback);
                timer.start();
                flvPlayback.play();

  • Mx:videodisplay.totalTime = -1

    I am trying to build a custom-progress bar which includes
    both the download progress as well as the play progress of an
    mx:videodisplay control, and allows the user to seek based on where
    on the progress bar they click.
    Here's how I am doing it:
    capture the position of the click from mouseEvent
    use it to calculate a percentage for how far down the
    progress bar the click occurred (0.0-1.0)
    multiply percentage by video.totalTime to determine what the
    desired time is
    set playheadTime equal to desired time
    My problem is that the totalTime property is returning -1.
    The video, however, remains playing, and the playheadTime property
    is legit too - the clock still counts up every second of the video
    as it plays. But since the totalTime property is -1 everything else
    gets screwed up, and when I attempt to seek anywhere, i get Error
    1003: Invalid Seek - understandable since seeking to a negative
    time doesn't make sense.
    Any information anyone has about how the totalTime property
    is calculated would be appreciated. Also below are a couple pieces
    of the code:

    Update. When I add single line "System.gc()" in onTimer function I no longer have a crash and memory usage is constant.
    Best Regards, Aleksey

  • The MessagePerformanceUtils:totalTime issue in Flex 4 (rpc.swc) using LCDS 3.1 running under JDK1.6

    We are facing an issue while using LCDS 3.1 running under JDK1.6 in Sun Solaris v5.10 OS & Adobe Flex 4.
    Scenario :-
    ===================================
    As part of our Flex-based client-server application (with Java backend) we have a performance report generation module. Following flex framework class is used to calculate the performance of various layer of a typical server-based request-response cycle.
    ; (available in rpc.swc library file)
    (for example : server time, cairngorm time, UI screen rendering time, UI event generation time etc).
    The totalTime was working properly before upgrading the rpc.swc to Flex 4 ; However it broke after migrating to Flex SDK 4; The totalTime is now coming as negative junk value.
    As we understand that the above Flex framework class method works in conjunction with LCDS running at server side on JDK.
    We suspect that the new rpc.swc taken from Flex SDK 4 is causing the issue !
    System information :
    Web Server : Weblogic 11G
    Operating System : Sun Solaris v5.10 OS running on Sparc hardware.
    Flex : Adobe Flex sdk 4.0
    Flash player : Adobe Flash Player 10
    Browser : Internet Explorer 8
    LCDS : 3.1
    JDK : JDK 1.6.0_14
    ===================================
    Has anyone faced similar problem before ? Any help or direction would be highly appreciated.
    Thanks in advance,
    Rabi
     mx.messaging.messages.MessagePerformanceUtils :totalTime

    Nothing has changed in the Flex SDK sources for this class since sometime around 2008. Are you running against the same LCDS server as you were before you updated to Flex 4?  This certainly seems strange (and bad).  Do you see the same behavior with Flex 4.5?  What was the version of Flex you were using before switching to Flex 4.0?
    If you can provide the additional information, we will look in to this.  A reproducable case that was a simple mxml application along with a simple destination config would help us narrow the problem.
    Sorry for the problems!
    Tom

Maybe you are looking for

  • Error while installing ECC6

    Hi All i am trying to install ECC6.0 and i face the following error during central instance installation. ERROR 2007-10-03 11:25:42 CJS-30022  Program 'Migration Monitor' exits with error code 103. For details see log file(s) import_monitor.java.log,

  • IPhoto won't export my slideshow? I get the message (OSStatus error - 108)

    I try to export my slideshow created from a photobook on 80 pages in iPhoto. I think I have tried everything and different formats. I get the message (OSStatus error - 108) no matter what I try. It's a photobook made for my sons 18 years birthday and

  • Should i buy a ipod 3g

    Hy guys I always didnt like apple (i like't galaxy's etc more) But i really wanna heve an ipod now since i ♥ apple products  now But the thing is i dont wanna waste a lot of money Thats why i wanna buy an ipod 3generation. But i heard u cant download

  • 1 order max 2 delivery billing doc  for each material (10 billing DOC)

    hai sap gurus this is my customer senario . in that sd process max sale order 1 & max delivery two , but customer required multible billing documents EXMPLE: sale order : 10 pcs delivery allowed ; 2(two) billing doc ; 10 billing doc foe each pcs plz

  • NEED HELP STRUCTURING A SUBSELECT - INVALIS IDENTIFIER ERROR

    This is my 1st post to this PL/SQL forum. I've used TSQL up to now; first job with PL/SQL and Oracle DB. I'm getting a "INVALID IDENTIFIER" error on the ORDER BY line (next to last line in code) in the following code. I haven't doen a lot of subselec