AS3 - 在FLV完成加载后,无法使用netstream.seek()擦除FLV

时间:2010-10-27 22:34:01

标签: actionscript-3

我正在尝试使用Netstream类播放FLV - 标准的东西,真的使用的东西比帮助文件中找到的东西更复杂。我创建了一个带有条的控制面板,您可以使用它来单击并拖动和擦除视频。

导出到Flash Player 9,它工作正常,我可以浏览视频,但仅在FLV仍在加载时。一旦达到100%,擦洗(使用Netstream.seek())就会变得非常无法响应,几乎到了让玩家崩溃的程度。

我已经杀死了所有的ENTER_FRAMES,删除了所有不必要的侦听器,并取消了我能想到的一切,但是一旦负载完成,大量资源密集的东西似乎就开始了。

有没有人见过这个?我从来没有碰到这个,也找不到各种各样的论坛。

下面的代码,但我不认为鼠标移动拖动动作是问题!在Flash CS4 IDE中很好,在浏览器中断开。

感谢您提供的任何帮助,

加雷

    // Drag
    private function dragVideo(e:MouseEvent):void {

        // Match the x position of the dragger to the x position of the mouse
        videoControls.progressBar.dragger.x = videoControls.progressBar.barInner.mouseX;

        // If this results in the dragger moving outside the dragging area, constrain it
        if (videoControls.progressBar.dragger.x < videoProgressRectangle.left) {
            videoControls.progressBar.dragger.x = videoProgressRectangle.left;
        } else if (videoControls.progressBar.dragger.x > videoProgressRectangle.right) {
            videoControls.progressBar.dragger.x = videoProgressRectangle.right;
        }

        // As the dragger moves, work out its position as a percentage of the total distance it CAN move
        // That distance is the width of the black inner bar but you must also accomodate the centred registration point of the dragger
        // So knock off half the dragger's width from it's current position (which gives the left edge of the inner bar)
        // Then knock off the dragger's width minus the 2px overhang of the white progress bar border, from the total draggable distance
        videoSeekPercentageMouse = (videoControls.progressBar.dragger.x - (videoControls.progressBar.dragger.width / 2)) / (videoControls.progressBar.barInner.width - (videoControls.progressBar.dragger.width - 2));

        // Now use that percentage to seek the video to the equivalent percentage of its total time
        if (videoSeekPercentageMouse <= 0) {
            videoNetStream.seek(0);
        } else if (videoSeekPercentageMouse >= 1) {
            // Because video metaData says the length is xyz while the real length is xyz + 0.015,
            // seek to slightly before the end 
            videoNetStream.seek(videoDuration - 0.016);
        } else {
            videoNetStream.seek(videoDuration * videoSeekPercentageMouse);
        }

        // Show the video's current progress
        videoControls.progressBar.barProgress.scaleX = videoSeekPercentageMouse;

        // After the mouse moves update the display
        e.updateAfterEvent();

    }

1 个答案:

答案 0 :(得分:1)

知道了!

你应该试试这个..

暂停流媒体“之前”寻求.. 寻求() 然后恢复流媒体!