Current frame for Spark VideoPlayer

Hi all,
I've been playing with the Spark VideoPlayer but can't find a way to get the playhead's frame position.
The playhead's time is fine, but that only works with seconds and I need to get the exact timecode.
Since I know the framerate and duration from the metadata I figured I should be able to calculate the milliseconds if I know what frame the head is on...
Or does anyone know another way to get the exact timecode?
Thanks
Skip

Never mind Ryan, I got it to work with the playhead now as well. Thanks for the advise.
Now I'm only running into a problem with the actual playheadtime.
I've got a 6 seconds clip that's played in the videoplayer and stops at the last frame.
The metatdata duration value is always 6 which is correct, but the playheadtime at the last frame varies between 5.9999 and 6.1.
Most of the time it's correct and stops at 6, but it doesn't seem to be reliable.
Do you know a workaround for that as well?
Thanks
Skip
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
   xmlns:s="library://ns.adobe.com/flex/spark"
   xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768">
<fx:Script>
<![CDATA[
import mx.events.StateChangeEvent;
import spark.events.VideoEvent;
[Bindable] private var duration:Number = 0;
[Bindable] private var currentTc:String = "";
protected function videoPlayer_currentStateChangeHandler(event:StateChangeEvent):void
protected function videoPlayer_enterFrameHandler(event:Event):void
if (event.target.playing) {
calcTC();
protected function videoPlayer_metadataReceivedHandler(event:VideoEvent):void
duration = event.metadataInfo.duration;
private function calcTC():void {
trace("playheadTime :"+videoPlayer.playheadTime.toString());
trace("metadata duration: "+duration);
var m:Number = Math.round(videoPlayer.playheadTime/60);
var s:Number = Math.floor(videoPlayer.playheadTime - (m*60));
var ms:Number = Math.round(1000*(videoPlayer.playheadTime - Math.floor(videoPlayer.playheadTime)));
var mss:String = "";
if (ms<10) {
mss = "00"+ms;
} else if (ms<100) {
mss = "0"+ms;
} else {
mss = ms.toString();
var tc:String = '';
tc += m<10? '0'+m : ''+m;
tc += s<10? ':0'+s : ':'+s;
tc += ':'+mss;
currentTc = tc;
protected function videoPlayer_playheadUpdateHandler(event:VideoEvent):void
//calcTC();
]]>
</fx:Script>
<s:VideoPlayer id="videoPlayer"
   source="barsandtone.flv"
   autoPlay="false"
   currentStateChange="videoPlayer_currentStateChangeHandler(event)"
   enterFrame="videoPlayer_enterFrameHandler(event)"
   metadataReceived="videoPlayer_metadataReceivedHandler(event)"
   playheadUpdate="videoPlayer_playheadUpdateHandler(event)"
   />
<s:Label x="441" y="18" text="Duration (s):" width="79" height="14" textAlign="right"/>
<s:Label x="533" y="18" id="durationLabel" text="{duration}" width="179" height="14"/>
<s:Label x="441" y="40" text="Timecode:" width="79" height="14" textAlign="right"/>
<s:Label x="533" y="40" id="tcLabel" text="{currentTc}" width="179" height="14"/>
</s:Application>

Similar Messages

  • Will only give print option of "current frame" for a six page PDF document opened from link in Safari.

    I'm new to Mac having just moved from a PC.  The TD Ameritrade site provides statements as PDF documents which are opened by clicking on a link.  The document is displayed in a pop-up window and there is no problem viewing all pages by scrolling.  But there is no PDF toolbar and Safari will only allow me the option of printing the "current frame", not the entire document or several pages.  What am I missing?  Does the Mac not actually bring it up as a PDF? 

    Hold down the OPTION key and click on the link. That will cause the document to download to wherever you set DLs to go. Then, open it in Preview and print everything.
    Since you're a newcomer to the Mac, see these:
    Switching from Windows to Mac OS X,
    Basic Tutorials on using a Mac,
    Mac 101: Mac Essentials,
    Mac OS X keyboard shortcuts,
    Anatomy of a Mac,
    MacTips,
    Switching to Mac Superguide, and
    Switching to the Mac: The Missing Manual,
    Snow Leopard Edition.&
    Additionally, *Texas Mac Man* recommends:
    Quick Assist,
    Welcome to the Switch To A Mac Guides,
    Take Control E-books, and
    A guide for switching to a Mac.

  • QuickTime Applescript Dictionary property for luminance on current frame

    Anyone know if there is a way to reference the luminance of the current frame via the Applescript dictionary?
    Or know of a scope application that applescript can use to get the luminance?

    I can't figure out how to capture the current frame of the flash movie sprite.
    You were almost there. Try either of these:
    put sprite("flash").currentFrame
    -- or
    put sprite("flash").frame

  • What is the best way to import a graphic? & How do I create a text frame for a figure caption?

    Hello all! I've been working from the FM book for almost 2 hrs trying to figure this out, so now I need your help. I am almost to this point:
    Problem I: Importing a graphic
    First of all, which is the best way?
    -Insert an anchor frame and then import the graphic into the frame OR
    -Just insert the graphic and get the anchor frame by default
    Here’s my importing and sizing problem:
    I hit ENTER to make a new paragraph line (side note: the book says make a new paragraph by hitting ENTER, import the graphic, and then ESC m+p to shrink wrap so that you can avoid the graphic overlapping the above text. I do exactly this (I believe), but my graphic still overlaps the above text when I shrink wrap. What the...?)
    I insert an anchored frame with position Below Current Line and alignment CENTER (I chose to the insert anchor frame, since this way I have control over its alignment, correct?)
    Anchor frame is selected when I import my image file
    In the Imported Graphic Scaling box, what do I select if my file is HUGE (3072x2304)?
    -Fit in selected rectangle (when I choose this the image imports small and fits in the anchored frame with lots of white space around it)
    -72 dpi
    -75 dpi
    -150 dpi
    -300 dpi
    -Custom dpi: 96 (I’ve tried changing this to a smaller number (20) and I get a message that says “cannot handle a bitmap of that size.”)
    I’ve had the best luck with selecting FIT IN SELECTED RECTANGLE, and then I just scale the image with my shift+click. If I choose 72 dpi or Custom, my image imports HUGE, and I just can’t manage it. I don’t have a method for resizing these images outside of FM.
    Problem II: Creating a text frame for a caption
    Once I have chosen FIT IN SELECTED RECTANGLE, I try to insert a text box underneath the image (and inside the anchor frame) to type a caption in it.
    In Create New Text Frame box, the default is Number 1 and Gap 0.25. I click SET.
    Next, I double-click inside the text frame to begin typing, but the cursor is OUTSIDE and UNDERNEATH the text frame! What the heck??? I’ve done this before and it has worked just fine. Then I had another problem where when I did get the text inside the text frame, I would select the text frame to move it, and it left the text behind! (I moved the frame but the text was separated from it and left behind.)
    THANK YOU in advance for your help. I hope I wrote this out clearly enough. I appreciate those who respond. P.S. I'm in FM 10.

    My favorite method is to use a one-cell table for graphics and captions.
    Import the graphic by reference into the table cell. Create a "Caption"
    paragraph tag and assign it to the table title. (The title can be set
    for above or below the table cell. I prefer below.) Now, whenever you
    insert this table, it will be ready for graphic and caption. Another
    advantage of this method is that graphic and caption always stay
    together at page/column breaks.
    When you create the table format above, assign it to have a -2.0 space
    above. Then, create a paragraph tag, such as "TableAnchor" and assign it
    -2.0 pt font size and -2.0 space below. (You can substitute a different
    point size, but it must be the same in all three places. The TableAnchor
    paragraph will hold the table and these settings let tables fit against
    the top margin where necessary. Otherwise, they dip down a bit.
    I wrote this from memory, so I hope I remembered all the steps!

  • The Export Frame for Classes specified in the Publish or Export settings

    Hi,
    I have a site I'm currently editing for a client, I'm adding a video element into it, but it doesn't play when I test movie, and when I test scene it gives me this error message:
    WARNING: The Export Frame for Classes specified in the Publish or Export settings, frame 2, does not exist. No bytecode for ActionScript 2.0 classes or interfaces was exported.
    I've heard its a bug in CS3
    Can anyone help?
    here's the actionscript:
    /**********---------- Config Part ----------**********/
    import cn.com.webstudio.util.*;
    Stage.scaleMode = "noscale";
    Stage.align = "TL";
    //Stage.showMenu = false;
    stop();
    /**********---------- Variable Part ----------**********/
    var xmlpath:String;
    var dataArr:Array = [];
    var curItem:Number = 0;
    //sound volume setting
    var volume:Number = 50;
    //buffer time setting
    var bufferTime:Number = 10;
    var locked:Boolean = false;
    //please set these fellowing value from external xml file.
    var autoPlayFirst:Boolean = false;
    var autoPlayAll:Boolean = false;
    var autoNext:Boolean = false;
    var mainStyleColor:Number = FFFFFF;
    var titleItem, videoItem, thumbList, controlItem, scrollItem;
    /**********---------- Function Part ----------**********/
    // Load the xml file.
    function loadXML(url:String, callback:Function) {
        var myxml:XML = new XML();
        myxml.ignoreWhite = true;
        myxml.onLoad = function(success) {
            if (success) {
                if (callback != null) {
                    callback(this);
        myxml.load(url);
    if(xmlpath !== undefined ){
    loadXML(xmlpath, parseXML);
    }else{
    loadXML("config.xml",parseXML);
    // parse xml data
    function parseXML(xml:XML) {
        curItem = -1;
        dataArr = [];
        var i, j, temp1, temp2, temp3;
        temp1 = xml.firstChild.firstChild.childNodes;
        // config part
        autoPlayFirst = temp1[0].firstChild.nodeValue=="false";
        autoPlayAll = temp1[1].firstChild.nodeValue=="true";
        autoNext = temp1[2].firstChild.nodeValue=="true";
        mainStyleColor = int(temp1[3].firstChild.nodeValue);
        // item data
        temp2 = xml.firstChild.childNodes[1].childNodes;
        for (i in temp2) {
            dataArr[i] = {};
            temp3 = temp2[i].childNodes;
            for (j in temp3) {
                dataArr[i][temp3[j].nodeName] = temp3[j].firstChild.nodeValue;
        init();
    function init() {
        // title item
        titleItem = this.attachMovie("titleItem", "titleItem", 1);
        titleItem._x = 68;
        titleItem._y = 21;
        // video list
        videoItem = this.attachMovie("videoItem", "videoItem", 2);
        videoItem._x = 68;
        videoItem._y = 50;
        videoItem.posX = videoItem._x;
        videoItem.posY = videoItem._y;
        videoItem.posW = videoItem._width;
        videoItem.posH = videoItem._height;
        // thumb list
        thumbList = this.attachMovie("thumbList", "thumbList", 3);
        thumbList._x = 558;
        thumbList._y = 20;
        // control item
        controlItem = this.attachMovie("controlItem", "controlItem", 4);
        controlItem._x = videoItem._x-1;
        controlItem._y = videoItem._y+videoItem._height+11;
        controlItem.posX = controlItem._x;
        controlItem.posY = controlItem._y;
        var mainStyleColor:Number = FFFFFF;
        //controlItem.volBut.onPress();
        // scroll item
        scrollItem = this.attachMovie("scrollItem", "scrollItem", 5);
        scrollItem._x = thumbList._x+thumbList._width-scrollItem._width+3;
        scrollItem._y = thumbList._y+thumbList.mask._y;
        // set main style color
        setStyle();
    function setStyle() {
        wEffect.setRGB(thumbList.back, mainStyleColor);
        wEffect.setRGB(controlItem.back, mainStyleColor);
        wEffect.setRGB(titleItem.back, mainStyleColor);

    click file/publish settings/flash/actionscript settings and make sure frame 1 is set as the export frame.
    if that's already set, don't use test scene.

  • How search text in current frame of external swf?

    Hello Everyone
    I am loading an external swf using loader.
    How do search and highlight the text in the current frame only?
    Is there a frame class which I could use?
    Thanks

    This is not likely to be possible in the general case, depending on what you mean by "searching text"
    For instance, a Word doc might have the text "Hello, world!" when viewed in Word, but that doesn't mean that the sequence of characters 'H', 'e', 'l', 'l', 'o', etc., exists in the file. There might be one letter, then some binary data indicating that the next letter is some other font or color, then one more letter, then more binary data, etc.
    Conversely, there could be textual metadata in a "binary" file that a person reading the file in the appropriate viewer would never see. Unless you know the details of the format you're reading, you won't be able to distinguish that from "real text".
    And what do you mean "strings" is not efficient? Have you tried it? Does it do what you want? Did you measure and determine that it does not meet your well-defined performance requirements? It's unlikely you'll be able to write code that does the same thing as "strings" but more "efficiently."
    The first step is to put more realistic boundaries on your requirements and define them more precisely. "Extract text from any binary file," is not a valid, meaningful, or reasonable requirement.
    EDIT: I may have misunderstood your requirements. I thought you wanted to "extract all text" from binary files. If that's not what you meant, and you're looking more to replicate grep, then follow Joachim's advice.
    Edited by: jverd on Mar 29, 2010 1:33 PM

  • Display current frame in applet.

    I am writing a Java applet that creates a media player. It plays a movie and I want to get the current frame. I have the code for this:
    FramePositioningControl fpc = ( FramePositioningControl)  player.getControl("javax.media.control.FramePositioningControl");
    int currentFrame = fpc.mapTimeToFrame(player.getMediaTime());I have created a text field and this is displayed on one of the panels of media player.
    My problem is that I can only get the frame number for the first frame to appear in the text field and it doesn't change for each frame.
    I have my code in the public synchronized void controllerUpdate(ControllerEvent evt) method as follows:
    tf3.setText(""+currentFrame);Any ideas as to how I can get each frame number to appear?
    I hope I have made myself clear enough.
    Thanks in advance,
    Wallace

    I have my code in the public synchronized void
    controllerUpdate(ControllerEvent evt) method as
    follows:controllerUpdate() is not called every time a new frame is encountered. It is called, for example, when the Processor or Player becomes "Realized", or is started or stopped.
    From your Processor or Player, you need to obtain the TrackControl that is an instance of VideoFormat.
    (note p is a Processor created and in the "Configured" state at this point in the code)
              TrackControl tc[] = null;
              // Obtain the track controls.
              tc = p.getTrackControls();
              // Search for the track control for the video track.
              TrackControl videoTrack = null;
              for( int i = 0; i < tc.length; i++ )
                   if( tc[ i ].getFormat() instanceof VideoFormat )
                        videoTrack = tc[ i ];
                        break;
              }You then need to create a custom Codec (or chain of Codecs) which you will insert into the data flow using p.setCodecChain( Codec[] codecs ) Override the process() method in your custom Codec to update your counter, as it will be called once for each frame.
    For example:
    public class PreAccessCodec implements Codec
         public final int process( Buffer in, Buffer out )
    //UPDATE YOUR COUNTER HERE!
             // Swap the data between the input & output.
             Object data = in.getData();
             in.setData(out.getData());
             out.setData(data);
             // Copy the input attributes to the output
             out.setFormat(in.getFormat());
             out.setLength(in.getLength());
             out.setOffset(in.getOffset());
             return BUFFER_PROCESSED_OK;
    }You will have to do a little searching through java.sun.com to find out about implementing a custom Codec, but I guarantee this will help you out... it is fundamental to the success of my application. I wish you luck!

  • Uix frameset - how to get the current frame name?

    I have a frameset with 3 different frames in it. a top, center and bottom.
    There is a menu in the top frame that changes the contents of the center or bottom frame.
    How can I get the value of the frame name for the current frame into a bound value like a httpsession or page?
    for example if I change the center frame to "listadmin.uix" how can I load a bound value with the frames new source?
    Is there a way to pass javascript to a boundvalue? I could get the frames new properties from javascript

    In Jdev 9.0.3 you could do something like this:<frameBorderLayout>
    <start>
       <frame name="sideFrame">
        <boundAttribute name="source">
         <ctrl:pageURL name="sideFramePage">
          <ctrl:properties>
           <ctrl:property key="currentFrame"
                          value="sideFrame"/>
          </
         </
        </
       </
    </
    </then in startFramePage.uix you can access the current frame name by doing:<styledText data:text="currentFrame@ctrl:page"/>

  • Access FLV metadata from Spark VideoPlayer

    Is there any way to access FLV metada in Spark VideoPlayer? There was metadataReceived event in past. But now there is no any event for metadata.
    Thank you

    I don't know PHP, but if PH can introspect the file and send
    that data to Flash in an XML format, then yes, you can do what you
    are asking. The key is PHP getting the data and then formatting it
    so that Flash can consume it.
    good luck!

  • External Video: Show Current Frame

    This isn't hugely important but since starting with FCP I have wanted to be able to show external video whenever I'm parked on a frame - i.e. not moving video. I often want "All Frames" off because it can choke on the full resolution/framerate I'm trying to assess.
    For the longest time I thought External Video / Show Current Frame was supposed to do this but just wasn't working. It eventually occurred to me that you have to shift-f12 every time you want the output updated.
    Is there a way to tell FCP to "show current frame" whenever I pause playback or step through frames?

    Another strategy is to turn off 'mirror on desktop'. That reduces the processor overhead significantly which is very useful on low power machines yet you get all your images sent to the external monitor.
    The check box can be found in: Menu Bar>Final Cut Pro>Audio/Video Settings> A/V Devices>
    Scrubbing in the Canvas works and the current frame will show up in Canvas when you stop messing around. Canvas is only bypassed when you play the timeline.
    good luck.
    x

  • About current frame property

    Hello I am trying to make as3 take action when a certain frame is reached. As far as I understand I need to use current frame property. But it does not work for some reason. It is about as. file so my object is referred to as "this". 
    if (this.hitTestObject(_root.mcBall)){
        _root.ballYSpeed *= -1
        if(!hit){      
            hit = true
            this.gotoAndStop(2)
        } else {      
            this.gotoAndStop(3)
      removeEventListener(Event.ENTER_FRAME, enterFrameEvents);
    _root.brickAmt --;
    I have animation playing inside frame 3 at the end of which goes to (parent) frame 4. How can I tell it if the current frame is 4 to do  _root.brickAmt --;  At this point? Is there another command I can use?
    Thanks!

    Yes I am sorry.... tried that 1 week ago..... Its the most logical solution and it would not work......Can I put "if" statement after "if" "else??...... This is the whole code. and the _root.brickAmt--; at the end is not responding....If I don't have   if (this.currentFrame == 4)... It works. May I ask why?
    public class Sinote extends MovieClip {
      private var _root:MovieClip;
      public function Sinote(){
      addEventListener(Event.ADDED, beginClass);
      addEventListener(Event.ENTER_FRAME, enterFrameEvents);
      private function beginClass(event:Event):void{
      _root = MovieClip(root);
      _root.brickAmt ++;
      private function enterFrameEvents(event:Event):void{
      if (this.hitTestObject(_root.mcBall)){ 
                  _root.ballYSpeed *= -1 
                 if (this.currentFrame == 1){   
            this.gotoAndStop(2)
            } else {                     
            this.gotoAndStop(3)
      if (this.currentFrame == 4){
      removeEventListener(Event.ENTER_FRAME, enterFrameEvents);
      _root.brickAmt --;

  • CP4 - View Current Frame of Captured Animation?

    Hello all, I'm a new CP4 user, so bear with me on this question.
    When editing, I was wondering how I can view the current frame under the playhead for a captured animation WITHOUT scrubbing?
    I have a bunch of captions to align to elements in the captured animation, but in edit mode I can only see the first frame of the animation, and I have to scrub (drag playhead) in the timeline to see what is visible in the animation at that time frame in which I am working.
    Thanks!
    Rob

    Hi there
    If you want to see the animation in a paused state, scrub the timeline using the mouse until you see the part where you wish to add a caption. Then, without releasing the mouse, press Alt + Tab to switch to a full screened application. You may now release the mouse. Press Alt+Tab to return to Captivate and you should still see the image as if you were still scrubbing. You could then screen capture it or use some other method to aid in correctly placing the caption or element you are adding.
    I'd like to add that this is but one of several reasons recording using Full Motion is generally a bad idea.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • When exporting a slideshow, what does "current frame rate" mean?

    I'm exporting a slideshow from iPhoto '11 and I'm using custom settings
    I am wondering when you click the custom settings button
    what does "current frame rate" mean?
    does it mean use the current frame rate that it uses to let me preview the slideshow?

    Welcome to the Apple Discussions. What happens to the slideshow other than giving you this error. Don't know what it means. However, several users have reported iPhoto crashing when trying to export a slideshow. You might search this forum for that to see if you're experiencing something similar. As far as I know there was no fix found.
    Be sure to report it to Apple via via http://www.apple.com/feedback/iphoto.html.
    OT

  • CSS reference chart for spark?

    I'm running into many issues when trying to add CSS into my project due to the way spark skins now work with CSS. Is there a CSS reference chart I can use or spark?  Also why did Adobe remove the CSS design view in flash builder 4?

    Hi,
    Can you elaborate on the issues you're having with CSS? The main change between Flex 3 and Flex 4 is 'CSS namespaces'. I don't know of a reference chart, per se,but I took the following from an article in Adobe Dev Center called 'Differences between Flex 3 and Flex 4 beta'.
    Flex 4 beta has  also added multiple namespace support in CSS. If you are using the MXML 2009, Spark, and Halo namespaces along with Type selectors, you will need to define a set of namespaces in your CSS definitions to avoid name collisions.
    Here is an example of CSS that uses type selectors for both Halo and Spark components:
    <fx:Style>
        @namespace s "library://ns.adobe.com/flex/spark";
        @namespace mx "library://ns.adobe.com/flex/halo";
        s|Button {
            color: #FF0000;
        mx|DateChooser {
            color: #FF0000;
    </fx:Style>
    The Halo and Spark skinning models are different enough that the existing CSS design view implementation (in Flex Builder 3) isn't the right solution for the task of skinning Spark components. The engineering team is currently investigating ideas to address this issue in FB4 for Spark components. (Btw, the CSS design mode is still available in Flash Builder 4, but only for Flex 3 SDK projects.)
    thanks
    Tim

  • Reading the current frame of an Event Structure

    Is there a way to read the current frame (or state?) of an Event Structure?
    Richard

    johnsold wrote:
    Normally a program would not stay in an event case for long enough for the phrase "current frame" to have much meaning.  What are you trying to do?
    Lynn
    Like tst assumed, it's for edit time use. Some events take a few seconds, and the progress would be nice to watch on the FP like you'd typically do with a state machine, and with dynamic events (as opposed to just user events), it would be nice to see where the structure is going.
    I have tried something with scripting as shown, but it's not much help. There's no property "Current Frame" or similar. Visible Frame (as shown) doesn't do it.
    Richard

Maybe you are looking for

  • Report generation toolkit with excel 97 Graphing issue

    I am trying to set-up mu data output to use the report generation Vis. However I am running into a problem when trying to update 2 graphs on the same sheet in Excel. My set-up is: Windows XP Office 97 LabVIEW 7.1.1 with the Office toolkit installed I

  • How to clean start up disc - macBookPro

    I need to clean my start up disc.......anyone know how?

  • HT3702 I'm having trouble making In-App Purchases.

    It keeps saying "Your Purchase Could Not Be Completed" and when entering the given URL, it just leads here which doesn't help as much. Any similar issues to this? It's been quite bothering since I just only need it then and there. Any way to resolve

  • RoboHelp 10.0.1 Update installation fails with error code: U44M2P7

    After installing RoboHelp 10, I ran the 10.0.1 Update's installer.  It failed with the following error log: Adobe RoboHelp 10.0.1 Update Installation failed. Error Code: U44M2P2 I tried re-installing RoboHelp 10, followed by a reboot of the machine. 

  • Forms doubts

    Hi, I am dynamically entering table name in my form, according to the table entered i want to retrieve number of columns processed by form. e.g count(*) select count (*) from :tab_name; this query does not work, what is the other way to retrieve tabl