flashplayer crash on Netstream.play()

  • 本站文章除注明转载外,均为本站原创或者翻译。
  • 本站文章欢迎各种形式的转载,但请18岁以上的转载者注明文章出处,尊重我的劳动,也尊重你的智商;
  • 本站部分原创和翻译文章提供markdown格式源码,欢迎使用文章源码进行转载;
  • 本博客采用 WPCMD 维护;
  • 本文标题:flashplayer crash on Netstream.play()
  • 本文链接:http://zengrong.net/post/1400.htm

Thank smithfox translation, 中文版

This is not a 100% frequency bug, I spent 3 days to debug it and I’m not sure I can duplicate it again.

Case

Connect to FMS Server using NetStream, once invoke method NetStream.play(‘streamName’), the flash player will crash.

all of flash player release have the same issue: single,debug,plugin

The bug will appear if satisfy the conditions below, ((but not all)

  1. Win7 OS
  2. Play RTMP stream. RTMP stream can be published by Flash Media Server(FMS) or Red5. In other words, playing local flv/f4v/mp4 video have not this problem
  3. the Stream contains audio
  4. Use Frame meta to pre-load. if you do not understand Frame pre-load, see this article: Preloaders in AS3;
  5. After complete pre-load, call ‘removeChild’ to remove the pre-loaded instance of the class (BUG here).

Development and testing platform (appear BUG)

  1. Flex SDK 4.5.1
  2. Flash Media Server 4.0
  3. Flash Player 10.3
  4. Windows 7
  5. Chrome12/Opera11.5/Firefox5/IE9

BUG reproduction

I’ve wrote two simple Demo (one is sender,and another is receiver) to reproduce this bug. (Demo needs FMS support.)

The key is PreloaderNSPlay.as. As the pre-loaded class is no longer needed after the completion of loading, the general way is removing it from Stage. Bug will occur after removal (not occur immediately, but in a time of receiving the audio stream). If using ‘visible’ to hide pre-loaded classes, would not have this problem.

Usage of the Demo (Here, the server is FMS)

  1. Install FMS, create folder /applications/testspeed/ under the installation directory
  2. Compile NSPulish.as and NSPlay.as, or download the swf file directly.
  3. Make sure that cameras and microphones are installed on your PC. run NSPublish.swf, click “connect” button, then view log to confirm the connection is OK,see the following figure. play the netstream
  4. If client has been connected the FMS server successfully, we will can watch the cameras video, if the flash player still does not crash, let’s breath toward the microphone, …huuuuu…., the whole wold are quiet!!
    crash

The full source code of the project is here

download

NSPublish.as is the video publisher, NSPlay.as is the receiver. You can build the project using Ant, and you can change the SDK in build.properties file.