A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: play head position from NetStream

  1. #1
    Junior Member
    Join Date
    Jul 2015
    Posts
    4

    play head position from NetStream

    Hi

    As a previous post I got resolved this morning, I have been asked to make amends to an old AS2 project and just don't know AS2 like I used to!

    I am using a NetStream to play a video in a container called my_video. I have the following on a button:-

    Code:
    on (release) {
    	var my_video:Video;// my_video is a Video object on the Stage
    	var my_nc:NetConnection = new NetConnection();
    	my_nc.connect(null);
    	var my_ns:NetStream = new NetStream(my_nc);
    	my_video.attachVideo(my_ns);
    	my_ns.play(_root.vid);
    	_root.my_video._alpha = 100;
    	my_ns.onMetaData = function(evt:Object):Void 
    	{
    		vidDuration_txt.text = this.time + "sec/" + evt.duration + "sec";
    	};
    This works to the point that it gets the file name from _root.vid and plays it in my_video. It also puts the starting time and duration in vidDuration_txt.text.

    However, I need vidDuration to read xsec/ysec where Y is the total duration (which works) and X is the playhead position... which currently just stays at 0 rather than increasing as the video plays. I need the X figure to increase as the video plays.

    Does anyone know what I can do to accomplish this?
    Thanks in advance.

  2. #2
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    my_ns.time contains the position of the playhead in seconds. The reason you're not seeing it constantly updated is that onMetaData isn't being called frequently enough. Get the value of my_ns.time periodically using setInterval instead.
    When your swf2exe tool just HAS to work
    there's only one choice... SWF Studio

  3. #3
    Junior Member
    Join Date
    Jul 2015
    Posts
    4
    Cool, thats done it!
    Thank you!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center