0

I am using the OSMF to play HDS videos, the player is hosted in a 'parent' player that removes the OSMF using unloadAndStop() which results with the following error:

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>()

When removing the OSMF using unload() the error does not occur .

I have made many attempts to resolve this or to try and catch the error but so far with no success, please share if you have any clue on how this might be resolved.

Thanks!

Eran

Eran
  • 1,628
  • 16
  • 31

1 Answers1

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

VC.One
  • 14,790
  • 4
  • 25
  • 57