0

我正在使用 OSMF 播放 HDS 视频,播放器托管在“父”播放器中,该播放器使用 unloadAndStop() 删除 OSMF,导致以下错误:

Error: Error #2154: The NetStream Object is invalid.  This may be due to a failed NetConnection.
  at flash.net::NetStream/play2()
  at org.osmf.net.rtmpstreaming::RTMPDynamicStreamingNetLoader/reconnectStream()
  at Function/<anonymous>()

使用 unload() 删除 OSMF 时不会发生错误。

我已多次尝试解决此问题或尝试捕获错误,但到目前为止均未成功,如果您对如何解决此问题有任何线索,请分享。

谢谢!

伊兰

4

1 回答 1

0

UnloadAndStop completely clears out everything (ready for Garbage Collector to free up the previously used memory) so now when your Play2() comes in, it finds access to nothing. You can try and separate a part of your code into smaller functions. i.e

  • Function One for setting up new netStream & netConnection etc
  • Function Two for playing netstream
  • Function Three can be for play2() where you have If/Else to check if not_unloaded == true then do play2(); else do Function One from here as a reset

PS: also these two links might help you as I dont (nor need to) know the rest of your code setup. Wether they talk about SWF files or Netstream it all applies the same

于 2014-05-20T12:38:22.187 回答