A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: flv pausing on first frame of actual video

  1. #1
    Member
    Join Date
    Sep 2006
    Posts
    49

    flv pausing on first frame of actual video

    Posted many flv videos here, http://jump-creative.com/, for a client. Some of them, no matter the buffer length, hesitate briefly on the first frame of actual video (not the black leader no matter the length). Specifically if you go to "work" and click on "Old Country For Old Men", "Boogeyman 3" or "The Grudge 3" (and others) the video loads to the buffer length, plays, hits the first frame of non-black video, hesitates for a beat and then continues. After it has loaded once, it streams fine on subsequent plays.

    Any way to prevent this brief hesitation? Client is very particular. Help?

  2. #2
    Senior Member
    Join Date
    Apr 2008
    Location
    Nottingham, UK
    Posts
    348
    are you using "your own" player? (ie not one you've bought in from a third party) Can you test this locally?


    I also note that the video appears to be in a playing state before it's finished buffering...which is quite confusing.

    Dan

  3. #3
    Member
    Join Date
    Sep 2006
    Posts
    49
    Thanks for responding Dan. It is my own player and it works like a charm locally. Here's my code. If you see something off, please let me know. thanks.

    Code:
    //-------NETCONNTCTION SETUP--------------
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    
    //-------NETSTREAM SETUP--------------
    var ns:NetStream = new NetStream(nc);
    
    ns.onStatus = function (info) {
    if(info.code == "NetStream.Play.Start") {
    progressBar.onEnterFrame = videoUpdate;
    }
    
    }
    
    ns.onMetaData = function (info) {
    ns.duration = info.duration;
    }
    
    //-------ATTACHING NETSTREAM--------------
    video.attachVideo(ns);
    ns.setBufferTime(15);
    
    //-------PLAYING EXTERNAL FLV--------------
    ns.play("oldmen.flv");
    
    //-------REWIND BUTTON--------------
    rewind.onRelease = function () {
    ns.seek(0);
    }
    
    
    
    
    //-------PLAY PAUSE TOGGLE--------------
    playPause.onRollOver = function () {
    if(this._currentframe == 1) {
    this.gotoAndStop("pauseOver");
    }
    else {
    this.gotoAndStop("playOver");
    }
    }
    
    playPause.onRollOut = function () {
    if(this._currentframe == 10) {
    this.gotoAndStop("pause");
    }
    else {
    this.gotoAndStop("play");
    }
    }
    
    playPause.onRelease = function () {
    if(this._currentframe == 10) {
    this.gotoAndStop("playOver");
    ns.pause(true);
    }
    else {
    this.gotoAndStop("pauseOver");
    ns.pause(false);
    }
    }
    
    
    
    //-------LOADBAR--------------
    loadbar.onEnterFrame = function () {
    this._xscale = (ns.bytesLoaded/ns.bytesTotal)*100;
    if(this._xscale == 100) {
    delete this.onEnterFrame;
    }
    }
    
    //-------VIDEO UPDATE--------------
    function videoUpdate () {
    progressBar._x = -146 + (ns.time/ns.duration)*loadbar._width;
    timecode.text = getTimecode(ns.time);
    }
    
    //-------VIDEO SCRUBBER--------------
    loadbar.onPress = function () {
    progressBar.onEnterFrame = videoScrub;
    }
    
    loadbar.onRelease = loadbar.onReleaseOutside = function() {
    progressBar.onEnterFrame = videoUpdate;
    }
    
    function videoScrub () {
    var dist:Number = (_xmouse-loadbar._x)/loadbar._width;
    ns.seek(Math.floor(ns.duration*dist));
    progressBar._x = -146 + (ns.time/ns.duration)*loadbar._width;
    timecode.text = getTimecode(ns.time);
    
    }
    
    //-------TIME CODE--------------
    function getTimecode (theTime) {
    var t:Number = Math.round(theTime);
    var min:Number = Math.floor(t/60);
    var sec:Number = t%60;
    var s:String = "";
    if(min < 10) {
    s += "0";
    }
    if(min >=1) {
    s += min.toString();
    }
    else {
    s += "0";
    }
    s += ":";
    if (sec < 10) {
    s += "0";
    s += sec.toString();
    }
    else {
    s += sec.toString();
    }
    return s;
    }
    
    //-------AUDIO CONTROLS--------------
    this.createEmptyMovieClip("vidSound",2);
    vidSound.attachAudio(ns);
    var vSound:Sound = new Sound(vidSound);
    vSound.setVolume(75);
    
    volScrub._xscale = 75;
    
    volBottom.onPress = function() {
    adjustSound();
    this.onMouseMove = adjustSound;
    }
    
    volBottom.onRelease = volBottom.onReleaseOutside = function() {
    delete this.onMouseMove;
    }
    
    function adjustSound() {
    var dist:Number = Math.floor(((_xmouse-volBottom._x)/volBottom._width)*100);
    if(dist >= 0 && dist <= 100) {
    volScrub._xscale = dist;
    vSound.setVolume(dist);
    }
    }

  4. #4
    Senior Member
    Join Date
    Apr 2008
    Location
    Nottingham, UK
    Posts
    348
    i've just had a cursory check over the code and I can't really see any issue with what you have, certainly not in terms of netstream code.

    having just tested this at home, with my laptop (and interestingly, running your site on Google Chrome) i have had no problems at all. I'm running vista here too, in case that would make any difference?

    at work i was on FF3 xp sp3 and definitely getting the symptoms you described. I also have a dedicated graphics card which may also make a difference.

    can you tell me what bitrate and actual image dimensions you encoded to? frankly, when it comes to video/encoding you look like you know what you're doing but I guess it pays to consider all angles.

    I have found (at least with CS3/flash player 9) that there are performance issues relating to bitrate/frame size when streaming videos without hardware acceleration.

    Dan

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