dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Problem with detecting FLV complete

  1. #1

    Problem with detecting FLV complete

    I have looked at threads until they are coming out of my ears and I still cannot get my movie to move to another frame after my FLV has completed playing. The FLV streams properly, however, after it completes playing it just stops. I want the root movie to go to frame 5. Below is my latest attempt at making this process work:

    //stops main timeline
    stop();
    //connects the video clip
    myNC = new NetConnection();
    myNC.connect(null);
    myStream = new NetStream(myNC);
    myStream.setBufferTime(2);
    flv_video.attachVideo(myStream);
    //below line plays the video
    myStream.play("capture_Small.flv");
    //waits for an event
    var myListener = new Object();
    myListener.complete = function(eventObject) {
    _root.gotoAndPlay(5);
    };
    fla_video.addEventListener("complete", myListener);

    Any suggestions before I start losing what's left of my hair?

    Rick

  2. #2
    Not Real since 1985
    Join Date
    Feb 2002
    Location
    Netherlands
    Posts
    229
    Apart from what is probably just a typo in your text above (flv_video and fla_video) ...
    I'm not sure but maybe using 'Netstream' you can't use a listener.
    A listener is used next to the component to play flv. Using netstream you may use onStatus but is has no 'status complete' defined.
    Hope it helps. Again: I'm not sure.
    Never accept the first 'impossible' unless it comes from a lady.

  3. #3
    Hi Louis,
    Yes, that is just a typo. I don't know enough about netStream or FLV as far as that goes. I used the above code because a post I ran across said it worked. I have seen many posts using netStream and a listener, however, I have no clue if their code works. So, I am still open to suggestions as to how to determine when an FLV has finished playing.

    Rick

  4. #4
    Not Real since 1985
    Join Date
    Feb 2002
    Location
    Netherlands
    Posts
    229
    I know of these three ways, down below. I tested all three snippets sometime ago. Maybe you can use one of the others to play your video and to wait for the end. At least the component knows status 'complete'.

    -- actionscript:
    Code:
    var my_nc:NetConnection = new NetConnection();
    my_nc.connect(null);
    var my_ns:NetStream = new NetStream(my_nc);
    my_ns.onStatus = function(infoObject:Object):Void {
    	status_txt += "status (" + this.time + "seconds)\n";
    	status_txt += "\t Level: " + infoObject.level + "\n";
    	status_txt += "\t Code: " + infoObject.code + "\n\n";
    };
    my_video.attachVideo(my_ns);
    my_ns.setBufferTime(5);
    my_ns.play("flv/export2_440x330_25_ni.flv");
    -- using class 'video'
    Code:
    import mx.video.NCManager;
    import mx.video.Videoplayer;
    
    var _dummy:NCManager;
    this.attachMovie("VideoPlayer", "my_vp", 10, {x:15, y:15, width: 440, height: 330});
    my_vp.autoSize = false;
    
    my_vp.load("flv/export2_440x330_25_ni.flv");
    my_vp.play();
    
    b_play.onPress = function() {
    	my_vp.play();
    }
    b_rew.onPress = function() {
    	my_vp.seek(0);
    }
    b_stop.onPress = function() {
    	my_vp.stop();
    }
    b_pause.onPress = function() {
    	my_vp.pause();
    }
    
    my_vp.volume = 50;
    var listenerObject:Object = new Object();
    listenerObject.playheadUpdate = function(eventObject:Object):Void
    {
    	var sec:Number = Math.floor(eventObject.playheadTime);
    	timer_txt.text = "T: " + sec; //my_video.playheadPercentage;
    	my_vp.volume = 50 + sec;
    }
    my_vp.addEventListener("playheadUpdate", listenerObject);
    my_vp.playheadUpdateInterval = 20;
    -- using the video component
    Code:
    import mx.video.*;
    var listenerObject:Object = new Object();
    listenerObject.playheadUpdate = function(eventObject:Object):Void
    {
    	var sec:Number = Math.floor(eventObject.playheadTime);
    	timer_txt.text = "T: " + sec; //my_video.playheadPercentage;
    }
    my_video.addEventListener("playheadUpdate", listenerObject);
    my_video.playheadUpdateInterval = 20;
    my_video.autoRewind = true;
    my_video.contentPath = "shot7.flv";
    b_play.onPress = function() {
    	my_video.play();
    }
    b_rew.onPress = function() {
    	my_video.seek(0);
    }
    b_stop.onPress = function() {
    	my_video.stop();
    }
    b_pause.onPress = function() {
    	my_video.pause();
    }
    Never accept the first 'impossible' unless it comes from a lady.

  5. #5
    I appreciate your efforts Louis,

    Unfortunately, I am beginning to think part of my problem is I am using MX2004 and from what I am reading, all of the features I am trying to use only work with newer versions of Flash.

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