red5pro / react-native-red5pro

React Native Red5 Pro Publisher/Subscriber
https://www.red5pro.com/
Other
34 stars 20 forks source link

Second time publish gives no output (ios) #21

Open stijnvanderlaan opened 6 years ago

stijnvanderlaan commented 6 years ago

No video is shown on the other side and the following error is given repeatingly:

writer error Error Domain=AVFoundationErrorDomain Code=-11840 "Cannot Encode" UserInfo={NSLocalizedDescription=Cannot Encode, NSUnderlyingError=0x1c84565c0 {Error Domain=NSOSStatusErrorDomain Code=-12915 "(null)"}, NSLocalizedRecoverySuggestion=Stop any other actions that encode media and try again., NSLocalizedFailureReason=The encoder required for this media is busy.}

bustardcelly commented 6 years ago

@stijnvanderlaan Do you mean if you reuse the same Publisher, the second time you go to publish you receive this error?

stijnvanderlaan commented 6 years ago

I don't know if it uses the same publisher under the hood, but I am not reusing the publisher, I remount a new R5VideoView. It even happens when I reload the bundle, I can only get back video once I rerun the app. The error is not consistent, the missing video on the other side is.

bustardcelly commented 6 years ago

We have noticed that using the Live Reload and Hot Reload features of React Native while in development do cause issues with the streaming - in most cases it not properly closing previous streams since componentWillUnmount is not consistently called when using those dev features.

As such, in development projects we have recommended to not use - or rather rely - on reloads when actively developing views with streaming. Instead we prefer to shake and Reload each time. I know it adds more time in development, but we cant trust React Native to properly clean up streams when using Live or Hot reloading.

rene-demonsters commented 6 years ago

@bustardcelly We do use Hot reload indeed. I'll have @stijnvanderlaan check if this is also actually the case with an APK version rather than the development build.