This is not a 100% frequency bug, I spent 3 days to debug it and I’m not sure I can duplicate it again.
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)
- Win7 OS
- 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
- the Stream contains audio
- Use Frame meta to pre-load. if you do not understand Frame pre-load, see this article: Preloaders in AS3;
- After complete pre-load, call ‘removeChild’ to remove the pre-loaded instance of the class (BUG here).
Development and testing platform (appear BUG)
- Flex SDK 4.5.1
- Flash Media Server 4.0
- Flash Player 10.3
- Windows 7
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)
- Install FMS, create folder
/applications/testspeed/under the installation directory
- Compile NSPulish.as and NSPlay.as, or download the swf file directly.
- 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.
- 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!!
The full source code of the project is here
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.