本文介绍了AS3的NetStream似乎并没有关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的code重用单个FLVPlayback组件变量。会有人知道为什么的NetStream不会停止?

I'm using the following code to reuse a single FLVPlayback component variable.Would anyone know why the NetStream doesn't stop?

public function clearVideoPlayer(newSource:String):void {

    if (_videoFLV) {
        removeChild(_videoFLV);
        _videoFLV.getVideoPlayer(0).close(); 
        _videoFLV = null;
    }

    _videoFLV = new FLVPlayback();
    _videoFLV.autoPlay = false;
    _videoFLV.autoRewind = false;
    _videoFLV.width = 320;
    _videoFLV.height = 240;

    _videoFLV.source =  newSource;
    addChild(_videoFLV);
}

但运行函数几次,accoring侦察后,的NetStream 不会被关闭。

在我得到用户界面的网络事件的行例如4×Recieving NetStream音频/视频,5×Recieving NetStream音频/视频,2×Recieving NetStream音频/视频

In the Network Events row of the UI I gete.g. 4 x Recieving NetStream audio/video, 5 x Recieving NetStream audio/video, 2 x Recieving NetStream audio/video

这推移下去,任何的视频后长度长。

This goes on indefinitely, long after the length of any of the videos.

谢谢

标记

推荐答案

您是否尝试过更换

_videoFLV.getVideoPlayer(0).close();

_videoFLV.closeVideoPlayer(0);

此外,设置 _videoFLV 是无用的,因为你只是后分配一个新的价值吧。

Moreover, setting _videoFLV to null is useless since you assign a new value to it just after.

这篇关于AS3的NetStream似乎并没有关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 13:29