Adding time to the FLVplayback component

Hi everyone, Im using the FLVplayback component for a project im doing. I want to add the time elapsed and time left on the controls. I dont really want to create my own controls, as im happy with the flv playback component. The FLVs playing in the component are external and are loaded into it via as3
Is there a quick and easy way of doing this?
Cheers
Dan

I have managed to find some code for this component, but im getting some errors which im having trouble to de-bug;
1118: Implicit coercion of a value with static type Object to a possibly unrelated type Function. vidPlayer.addEventListener("metadataReceived", listenerObject);
1118: Implicit coercion of a value with static type Object to a possibly unrelated type Function. vidPlayer.addEventListener("playheadUpdate", listenerObject);
Please would someone take a look and let me know what im doing wrong?
Thanks
code:
var listenerObject:Object = new Object();
var fullDuration = null;
listenerObject.metadataReceived = function(eventObject:Object):void {
    fullDuration = prettyTime(vidPlayer.metadata.duration);
listenerObject.playheadUpdate = function(eventObject:Object):void {
    var paTime = vidPlayer.playheadTime;
    if(fullDuration != null){
//updates the text box with the instance name timeCode_txt on the root timeline.
//best to use a monospace typeface like calibri for the textbox font.
        time_txt.text = prettyTime(vidPlayer.playheadTime) + " / " + fullDuration;
vidPlayer.addEventListener("metadataReceived", listenerObject);
vidPlayer.addEventListener("playheadUpdate", listenerObject);
function prettyTime(timeinSeconds):String{
    var seconds:Number = Math.floor(timeinSeconds);
    var minutes:Number = Math.floor(seconds / 60);
    var hours:Number = Math.floor(minutes / 60);
    //Storing the remainder of this division problem
    seconds %= 60;
    minutes %= 60;
    hours %= 24;
    //Converting numerical values into strings so that
    //we string all of these numbers together for the display
    var sec:String = seconds.toString();
    var min:String = minutes.toString();
    var hrs:String = hours.toString();
    //Setting up a few restrictions for when the current time reaches a single digit
    if (sec.length < 2) {
        sec = "0" + sec;
    if (min.length < 2) {
        min = "0" + min;
    if (hrs.length < 2) {
        hrs = "0" + hrs;
    //Stringing all of the numbers together for the display
    var time:String = hrs + ":" + min + ":" + sec;
    //Setting the string to the display
    return time;

Similar Messages

  • A better way to determine the current state of the FLVPlayback component?

    Below is the AS3 code I have used to display images (MCs) over an instance of the FLVPlayback component.  These images (one for loading, one for the title) are to appear – or disappear – according to the current state of the FLVPlayback component. 
    It “works,” but when testing, I have noticed that it can be rather finicky.  The most common issue that arises is that many times the loadPoster movieclip will still be visible even though the video has entered the playing state.
    Also, I wanted a title placeholder image to appear whenever the user stops the video or if the video completes.  However, I had to add the conditional statement to the “stoppedStateEntered” case to make everything appear when expected.  When the video is first viewed (and has completed buffering), it seems that the FLVPlayback component enters the stopped state before entering the playing state.  Thus, the titlePoster would flash on the screen right before it and the loadPoster “should” disappear when the video begins playing.
    Even in my limited testing, these issues were very easily re-created.  I am definitely looking for a more reliable solution.  Is there a better (or more correct) way to go about all this?  If possible, I would like to stick with the FLVPlayback component, just for the simple fact of not having to code my own.
    Where am I going wrong?
    function updateMoviePoster(event:VideoEvent):void
                    switch (event.type)
                                    case "playingStateEntered":
                                                    loadPoster.visible = false;
                                                    titlePoster.visible = false;
                                    break;
                                    case "stoppedStateEntered":
                                                    if (loadPoster.visible == false)
                                                                    titlePoster.visible = true;
                                    break;
                                    case "complete":
                                                    titlePoster.visible = true;
                                    break;
    myFLVPlayback.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, updateMoviePoster);
    myFLVPlayback.addEventListener(VideoEvent.STOPPED_STATE_ENTERED, updateMoviePoster);
    myFLVPlayback.addEventListener(VideoEvent.COMPLETE, updateMoviePoster);

    Any suggestions?  I would truly appreciate the help.

  • Adding Images to the List component

    Adding Images to the List component while using the FLV
    PLayback
    All, ( i can send you my source files if it would help)
    I'm using the FLV Playback component and loading videos into
    it from an external xml file. I also have a list component tied to
    the FLV playback that when you click on one of the elements in the
    list, it plays that movie.
    QUESTION:
    My question is how do I add an image to the list component?
    Below is the xml file and the actionscript. I've added the image
    attribute to the XML file as img="time_square.jpg" and added the
    element of the array when calling/creating the list. Did I do this
    right?
    Any direction would be very much appreciated.

    Adding Images to the List component while using the FLV
    PLayback
    All, ( i can send you my source files if it would help)
    I'm using the FLV Playback component and loading videos into
    it from an external xml file. I also have a list component tied to
    the FLV playback that when you click on one of the elements in the
    list, it plays that movie.
    QUESTION:
    My question is how do I add an image to the list component?
    Below is the xml file and the actionscript. I've added the image
    attribute to the XML file as img="time_square.jpg" and added the
    element of the array when calling/creating the list. Did I do this
    right?
    Any direction would be very much appreciated.

  • Will the FLVPlayback component play MP3's without FMS?

    Will the FLVPlayback Component (version 2.5.0.15) play an MP3 file without it having to be streamed through a Flash Media Server? All I'm looking for is to place a player into my Flash that plays an MP3 file that's in the same directory as the SWF.
    Here's my code... it's pretty simple:
    import fl.video.FLVPlayback;
    var myMusic:FLVPlayback = new FLVPlayback();
    myMusic.source = "mySong.mp3";
    myMusic.skin = "SkinOverPlayMute.swf";
    myMusic.skinBackgroundColor = 0xCCCCCC;
    addChild(myMusic);

    So the answer is no, correct?  FLVPlayback will not handle MP3 files?
    My new script, in case anyone is interested:
    import flash.media.Sound;
    import flash.net.URLRequest;
    var songTitle:String = "Shake Your Rump"
    var fileName:String = "shakeYourRump.mp3"
    var myMusic:Sound = new Sound(new URLRequest(fileName));
    var soundChannel:SoundChannel;
    var isPlaying:Boolean = false;
    var currentPosition:Number = 0;
    btn_Rewind.addEventListener(MouseEvent.CLICK,rewindMusic);
    btn_Play.addEventListener(MouseEvent.CLICK,playMusic);
    btn_Pause.addEventListener(MouseEvent.CLICK,pauseMusic);
    txt_Status.text = 'Click play to hear "' + songTitle + '"';
    function rewindMusic(myEvent:Event): void {
    currentPosition = 0;
    txt_Status.text = 'Rewinding "' + songTitle + '"  Click play to restart.';
    if (isPlaying) {
    soundChannel.stop();
    soundChannel = myMusic.play(currentPosition);
    txt_Status.text = 'Playing "' + songTitle + '"';
    function playMusic(myEvent:Event): void {
    if (!isPlaying) {
    soundChannel = myMusic.play(currentPosition);
    isPlaying = true;
    txt_Status.text = 'Playing "' + songTitle + '"';
    function pauseMusic(myEvent:Event):void {
    if (isPlaying) {
    currentPosition = soundChannel.position;
    soundChannel.stop();
    isPlaying = false;
    txt_Status.text = '"' + songTitle + '" is paused. Click play to resume.';
    stop();

  • Controlling the FLVplayback component Volume

    Hi there,
    I have a FLVPlayback component which I have modified to the
    core.There is one problem with the volume slider. Im using Flash
    Professional 8 with XP, and the skin Im using is
    "steelExternalAll". Suppose I load some file into the contentPath,
    it plays, and I drag the volume slider up (100%) and down(0%) for a
    couple of time I get a bug. The bug is that when Im finally in the
    down state, with 0% I still hear the sound which was in the
    previous status, say 38 or 50%. And it happens in the reverse too.
    Why is this happening? Can i resolve it?
    I tried doing this using a fresh FLASH file, still the result
    is the same. It happens once in a 10 times, but this surely is a
    defect i need to handle. I dont think I have enough API's to do
    something serious. Can anyone help me out?

    Hi kglad,
    Greetings. Felt so glad when I saw your reply saying that the
    problem was with the skinning, because I did one hell of a
    skinning. But I had a crosscheck. I tool a sample
    "steelExternalAll" skin, just like it is in the component panel,
    and just added a contentPath. Simple. I checked for the volume
    slider problem, and there it was.
    I can find the problem in the normal unmodified skin. This is
    the same problem I face. Can this be solved. There is no other code
    piece Im using other than the one given below.
    Thanks a lot for your kind patience.

  • How can I save a video's position using the FLVPlayback component

    I've got a video I'd like people to be able to navigate away from in my project, but resume where it left off if they come back to it.  I would think I could do this by just saving its current position when they exit that frame as a variable and then using .seek() to go back to that spot if/when they return.
    The only problem is that I can't find any script to capture the current position.  I tried .time, but it gives me an error.

    This is what I ended up doing.  I put the FLVPlayback inside a movieclip and put this on the first frame:
    stop();
    var vidTime:Number=0;
    on the frame that the video plays on I have the video and a close button (which is a movieclip) and I put the following script:
    if(vidTime>0)
        htMeasVid.seek(vidTime);
    close_btn.addEventListener(Event.ENTER_FRAME, seekCount);
    close_btn.addEventListener(MouseEvent.MOUSE_UP, closeBtnUp);
    function seekCount(e:Event):void
         vidTime=htMeasVid.playheadTime;
    function closeBtnUp(e:MouseEvent):void
        e.currentTarget.parent.play();
    on the following frame I have this code:
    close_btn.removeEventListener(Event.ENTER_FRAME, seekCount);
    htMeasVid.stop();
    and then on the last frame I have this:
    gotoAndStop(2);
    so that it doesn't reset the vidTime variable to 0.
    Thanks again for the help.

  • Simple Timer using the History Component

    I spent ages trying to do this, but there's a simple and elegant solution, so I thought I'd better share it.
    1. in cell A1 put the formula "=sum(A2+1)"
    2. add a new history component, with data cell A1, insertion cell A2, and timer interval to 1 second
    3. add a label to the dashboard pointing at cell A1, and you have a timer!
    Here's a [swf file example|http://timoelliott.com/blog/docs/simple_clock.swf] of a simple clock example and here's [the original file|http://timoelliott.com/blog/docs/simple_clock.xlf] (Xcelsius 2008 sp3)

    I have 4 places where the red and white Audio cables could go:
    The red and white audio slots for "Componant."
    The red and white audio slots for "DVI"
    The red and white slots for "AV In" (Typical yellow white red slots.)
    The red and white slots in the SCART adaptor for "RGB"
    Which of these four? I have previously tried all of them to no avail.
    Thanks,
    - Jamwllms.
    Message was edited by: Jamwllms

  • Adding time at the end of a movie

    Is there a way to add a couple seconds of black at the end of a movie without having an object on the timeline?

    You could try extending the work area, but why not just put a black matte and do the job properly?
    If you play out the timeline to tape, a very short black clip at the end will generate permanent black output to tape, so you can avoid longer timelines that way if you wish. But exporting to file needs all frames to be specified.

  • Making the flv component accessible?

    I am using the flv player component and am having trouble adding the players buttons to the tab order.
    I opened the FLA for the skin I am attaching to the component, and individually selected the play, close caption and full screen button and assigned them each a tab order number within the Accessibility window. I also selected the "make object accessible" checkbox for each button within the Accessibility window. Doing that didnt seem to work, so I looked further and found that there is an accessibility class and I have now tried to utilize that class with the following code:
    import fl.accessibility.ButtonAccImpl;
    ButtonAccImpl.enableAccessibility();
    but still dont seem to be doing something right?
    does anyone have experience accessibility and the flv player component?
    many thanks in advance.
    corey.

    i found this on adobes site but the code dosent seem to be correct? it throws this error when i publish:
    Scene 1, Layer 'actions', Frame1, Line 10 1046: Type was not found or was not a complie-time constant: Void.
    DESCRIPTION:
    The FLVPlayback component skins with captioning support were designed with keyboard and screen reader access in mind. The class mx.video.skins.AccessibleSkin assigns a text label to each of the FLVPlayback controls. The AccessibleSkin class also provides the method assignTabIndexes for assigning tab index values to the FLVPlayback controls and incorporating them into the logical tab order of your Flash application. The assignTabIndexes method accepts a start index as a numeric parameter, iterates through the FLVPlayback controls assigning a unique tab index value to each control, and returns the next available tab index number.
    CODE:
    // The starting tabIndex for the FLVPlayback controls
    var nextTabIndex:Number = 10;
    // define a listener object
    var listenerObject:Object = new Object();
    // define a skinLoaded event handler
    listenerObject.skinLoaded = function (eventObject:Object):Void
        // this is technically a hack since the skin_mc is
        // a private property of the FLVPlayback component
        var accessibleSkin = eventObject.target.skin_mc.accessibleSkin;
        if(accessibleSkin){
            // It's best to wait a frame until
            // all FLVPlayback controls initialize
            var intID:Number;
            intID = setInterval( function(){
                // assign tabIndexes starting at nextTabIndex
                nextTabIndex = accessibleSkin.assignTabIndexes(nextTabIndex);
                // trace the next tab index after
                // FLVPlayback controls
                trace( nextTabIndex );
            clearInterval(intID);
            }, 100 );
    // register listenerObject to handle "skinLoaded" event.
    // this code assumes that your FLVPlayback component instance is
    // named "myFLVPlayback_flvp"
    myFLVPlayback_flvp.addEventListener("skinLoaded",listenerObject);
    i miss good old AS2
    thanks again in advance for any help.
    corey

  • Switching between FLVPlayback component at their playheadTime

    Hi There,
    I hope someone can save me with this.
    I am currently on a project (AS3), where I have 2 frames, with videos (using the FLVPlayback component).
    and I want to switch from one video to the next video, however the catch is when i switch to the next video I want the new video to play at the previous video time.
    example:
    Video 1 plays,  10 sec later, you click a button to go and see the next video (in another frame) and that new Video starts 10 sec into it.
    This is the codes I been using so far:
    import fl.video.VideoEvent;
    import fl.video.MetadataEvent;
    video1.addEventListener(VideoEvent.PLAYHEAD_UPDATE, timer);
    function timer(e:VideoEvent):void {
        var newTime = video1.playheadTime;
    nextFrame_btn.addEventListener( MouseEvent.MOUSE_UP, nextFrame);
    function nextFrame (MouseEvent):void
                gotoAndStop(2);
          video2.playheadTime = newTime;
    This doesn't work and I do not know what I am doing wrong.
    many thanks if you can help.

    yes there is another layer with codes but that is for the buttons.. that can work throughout the flash (in all frames). Sorry I forgot about that. Those buttons are just basic home, end buttons. In the other layer is the switch code for the button I am trying to make.
    This button/code for some reason does not like being in the main code layer. So I added it in another layer, which seem to make it work. (The part where I want it to gotoAndStop in another frame.)
    var newTime:int;
    switch_btn.addEventListener(MouseEvent.MOUSE_UP, switch1);
    function switch1 (MouseEvent):void // Function to turn on 3D mode
                        newTime = video1.playheadTime;     
                        this.addEventListener(Event.RENDER,renderF);
    trace("stage:",stage);
                        stage.invalidate();     <= that use to be line 15 before the trace was added.
            gotoAndStop(2);  
                        trace (newTime);
    function renderF(e:Event):void{
      video1.seek(newTime);
    the other layer has this code:
    cha1_btn.addEventListener(MouseEvent.MOUSE_UP, cha1);
    chan2_btn.addEventListener(MouseEvent.MOUSE_UP, chan2);
    function cha1 (MouseEvent):void
              gotoAndStop(10);
    function chan2 (MouseEvent):void
              gotoAndStop(11);
    They are on seperate layers because the switch function is used in all the frames, but to gotoAndStop in different frames.
    aka this one: is in frame 10, which goes to frame 2
    and there will be another one in frame 2 to go to frame 10.
    then there is another in frame 11, which goes to frame 3
    and then the same for frame 3 to goto frame 11.
    so thats why there were in seperate layers, to be able to change that. (sorry if this is getting confusing)

  • Android Back Button when FLVPlayback component in full screen

    I'm launching an FLVPlayback component in to full screen by setting fullScreenTakeOver = true and setting StageDisplayState to FULL_SCREEN in an air for android app. This works fine. The video plays in full screen
    But when I press the device Back button, it quits out of the app.
    Everywhere else in the app I can catch the key_down event and do preventDefault(), stopImmediatePropogation(), but the event doesn't seem to fire when FLVPlayback is in full screen.
    I've tried adding the Key_Down event listener to NativeApplication.nativeApplication, to stage and to the FLVPlayback component itself. None of these seem to work.
    I do, however, get the correct behaviour when I test the app in Flash IDEs simulator
    Thanks
    Ben
    EDIT:
    Also worth noting. Using latest Flash CC and AIR 17 testing on an S4

    www.giancarlogenise.com
    the video is in the promo section.
    if you navigate the site without pressing the Full screen button, everything is fine.
    If you click the full screen , strange behaviours every time
    I bought this template, but I have to add the video section by myself.

  • Remove sound in FLVplayback component?

    How do you remove the sound from "specifically" from FLVplayback component? Since the sound wont stop playing when I'm on different page(assume that if the person didnt click the pause button and navigate to other pages)....Normally I would add SoundMixer.stopAll(); for every button in my main and loaded swf but this will stop my background music as well....
    The flvplayback component is located in another swf file and the code was added on the second frame of the movieclip call "scrollGroup"
    import fl.video.FLVPlayback;
    import flash.events.Event;
    var flvPlayback:FLVPlayback = new FLVPlayback();
    flvPlayback.fullScreenTakeOver = false;
    flvPlayback.autoPlay = false;
    flvPlayback.source = "video/Listening_to_Community_Voices.f4v";
    flvPlayback.skin = "MinimaFlatCustomColorPlayBackSeekCounterVolMuteFull.swf";
    flvPlayback.x = 31;
    flvPlayback.y = 123.8;
    addChild(flvPlayback);

    http://forums.adobe.com/message/2587415?tstart=0

  • FLVPlayback Component for AIR & IOS

    Hello,
    I have referenced this and other forums several times in regards to this question, but would like to canvas it myself here once more in hopes of any new or additional insights that were absent before.
    I am developing an AIR application that uses a long (45min) video as a centerpiece. It necessarily (I think) needs to be applied with the FLVPlayback component because it is both masked by menu and playback controls, and has a large variety of interactive content layered on top of the full-screen (more or less) video.  As of now, the video is encoded in FLV, and works fairly well, but I do have some lingering performance issues, which I am asking help with here today.
    I have read that using FLV in iOS apps is not advised, but for the reasons listed above I most likely will have to do so. I don't think I can use the other options (stagevideo, or otherwise) due to the layering of content above the video, and an irregular mask. I have placed the video in the main directory of the app package (which made all the difference), used GPU, and tweaked the encoding ad nauseam. While all-in-all it has resulted in "okay" performance, I still have a slight but noticeable skip/hiccup/jump in the video during the more graphically intense portions of the production. This only occurs on the iPhone 4/s devices, while the iPhone 5 experience is flawless.
    So I am asking for ANY help/suggestions anyone could offer towards a possible solution/improvement to this problem. I would be grateful for any other setting, encoding, file structure, or alternate suggestions that I have not thought of or addressed.
    Thank you.

    Hi Freelance77,
    The product team would like to know the steps to reproduce this issue. After that, we can try solving it for you. Do let us know.
    Thanks,
    Preran

  • Opening .mp4 files using flvplayback component 2.5 in Air 3.2

    I've publishing the package using the extended desktop profile and captive runtime.
    When I run the published .exe file from a hard disk (either on my local machine or other test machines) it works fine, so I know that I have my code at least partially correct.
    I'm accessing the .mp4 files from a subdirectory of the applicationDirectory (eg: app:/video), the file names are read in from a .xml file.
    Example structure:
    exampleVideoSource = File.applicationDirectory.url+"video/12-16/attacking when in balance/counterattacking 2.mp4"
    Is this likely to confuse the FLVplayback component, if so what's the best way to get a working path?
    Thanks,
    Dan

    Discovered the issue.
    For mounted drives you need to use the nativePath property.
    For cross platform applications you can simply replace() the delimiter with the .separator property.
    Also for some reason the skin wouldn't load, despite the fact that I had chosen it in the component selector.
    I ended up setting the myFLVplayback.skin property just before I added the component to the stage.
    On  a related note, does anyone know if there's a difference between publishing an app with included folders, and simply publishing the app and adding the folders to the .app directory after the .app folder has been published?
    Dan

  • How to recognize FLVPlayback Component

    Publish to Flash 8 and using the FLVPlayback component as part of a larger elearning course.
    We have a legacy pause button that works by recursively looking through every item on stage and if the item is a movieclip following its children and so on. Something like this (there is more to the whole thing, but this is where the problem is):
    findCurrent = function (obj)
    // RECURSIVE SEARCH FOR MOVIECLIPS
    for (var i in obj) {
      if (typeof (obj[i]) == "movieclip" && obj[i] != obj) {
       if (obj[i]._name == "pauser"{
        continue;
       var m = obj[i];
       m.frameWas = m._currentFrame;
       isCurrent.push(m);
       findCurrent(m);
    The issue is that when using the FLVPlayback component the 256 recursions limit is reached. I'm guessing that the video part contains a reference to playback controls skin and the playback controls skin contains a reference to the video part and the recursion just goes round and round till it hits the limit and then all actionscript is disabled for the rest of the file.
    I thought of adding a counter, and that is probabaly a good idea, but I was wondering if there is anyway to identify that I've hit a video player and stop following it?
    Obviously the topeof(myVideoPlayer) is coming back as "movieclip" or I wouldn't be getting this problem. I don't think there is a getQualifiedName for AS2, right? I looked at the properties and couldn't find one that said, "clearlyVideoPlayer."
    So does anybody else have any suggestions?

    if you don't have other components/movieclips (that use boundingBox_mc):
    findCurrent = function (obj) {
        // RECURSIVE SEARCH FOR MOVIECLIPS
        for (var i in obj) {
            if (typeof (obj[i]) == "movieclip" && obj[i]._parent==obj) {
                if(i=="boundingBox_mc"){
                    findPauseF(obj);
                    abortSearch=true;
                if(!abortSearch){
                    findCurrent(obj[i]);
    function findPauseF(flv:MovieClip){
        // do whatever with flv

Maybe you are looking for

  • Message: External USB HDD must be formatted

    Hello when I am inserting the USB wire for the hard disk it says the device must be formatted Then I clicked on format, it gives me a message that the drive is not connected correctly. Recently I inserted it an icon has appeared in the windows bar. W

  • Iphoto update

    Hi I'm not sure why but my computer says it will not accept the new iPhoto update....why is this? Also, I burned a disc of cd's from my friend who had the iphoto update and tried to then upload these into my computer but it said I couldn't becuase I

  • Homesite R.I.P

    Macromedia sure knows how to kill a popular and amazing product. WHY not sell the source to a company that cares? PLEASE ALLAIRE TELL ME I'M DREAMING, Tell me that the Devil (Macromedia) did not buy this software from you, just to let it go. GOD DAMN

  • ODS Initialization failed

    Hi All, I ahve done initializaion with data transfer and loaded the repair full request in the ODs... and while next day when i performed the delta update they was the problem in the initialization and now all the delta was falied i would like to con

  • Compress String in ABAP from CHAR10 to CHAR6...

    Hi, I need to convert a CHAR10 string field to a CHAR6 string field. Does anyone know how to perform this compression so that the CHAR6 field can also be uniquely decompressed back to the CHAR10 field. Any help on this is welcome...:) Regards, Rishab