AS3 NetStream doesn't seem to close

元气小坏坏 提交于 2019-12-12 02:54:20

问题


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);
}

But after running the function several times, accoring to Scout the NetStream doesn't get closed.

In the Network Events row of the UI I get e.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.

Thanks,

Mark


回答1:


Have you tried to replace

_videoFLV.getVideoPlayer(0).close();

by

_videoFLV.closeVideoPlayer(0);

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



来源:https://stackoverflow.com/questions/15083390/as3-netstream-doesnt-seem-to-close

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!