4

I'm trying to include a streaming service inside of an cordova hybrid app for iOS and Android. We chose red5pro because it is an 1 broadcaster to n subscriber situation and theirfor we need a server which is broadcasting to the subscribers. The broadcasting is simply done via webbrowser on a laptop and there is no problem with that but the recieving is going to be inside of the app.

red5pro has 3 example usecases for HTML streaming, native Android and native iOS. We are developing a hybrid mobile app, so we chose the HTML method.

We did a test setup on which you can open an URL in any webbrowser and see the steam, which works fine on firefox, chrome and safari. However, if we try to open the stream via chrome on an android device, we get the following error message:

2017-11-10T15:57:26.862Z - [red5pro-sdk] error: (RTCSubscriber) [onsdperror] red5pro-sdk.min.js:9
2017-11-10T15:57:26.877Z - [red5pro-sdk] error: (OperationError: Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: Failed to set remote video description send parameters..) undefined red5pro-sdk.min.js:9
Uncaught (in promise) Invalid SDP.
  value @ red5pro-sdk.min.js:9
  (anonymous) @ red5pro-sdk.min.js:9
  Promise rejected (async)
  value @ red5pro-sdk.min.js:9
  value @ red5pro-sdk.min.js:9
  value @ red5pro-sdk.min.js:9
  value @ red5pro-sdk.min.js:9
  e.onmessage @ red5pro-sdk.min.js:9
2017-11-10T15:57:26.889Z - [red5pro-sdk] error: (RTCSubscriber)[onsdperror] red5pro-sdk.min.js:9
2017-11-10T15:57:26.892Z - [red5pro-sdk] error: (OperationError: Failed to set local sdp: Session error code: ERROR_CONTENT. Session error description: Failed to set remote video description send parameters..) undefined red5pro-sdk.min.js:9
2017-11-10T15:57:31.059Z - [red5pro-sdk] error: (RTCSubscriber) Error in stream subscription: Session start failed for lukas.

"Invalid SDP" this message appears after the subscription to the stream is done.

My sample code for the client: HTML:

<!doctype html>
<html>
  <head>
    <!-- Recommended shim for cross-browser WebRTC support. -->
    <script src="https://webrtc.github.io/adapter/adapter-latest.js">            
</script>
    <!-- Default Red5 Pro Playback Control styles. -->
    <link href="lib/red5pro/red5pro-media.css" rel="stylesheet">
    <!-- Fullscreen shim. -->
    <script src="lib/screenfull/screenfull.min.js"></script>
  </head>
  <body>
    <video id="red5pro-subscriber"
           class="red5pro-media red5pro-media-background"
           autoplay controls>
    </video>
    <!-- Exposes `red5prosdk` on the window global. -->
    <script src="lib/red5pro/red5pro-sdk.min.js"></script>
    <!-- Example script below. -->
    <script src="js/main.js"></script>
  </body>
</html>

And the Main.js:

(function (red5prosdk) {

  // Create a new instance of the WebRTC subcriber.
  var subscriber = new red5prosdk.RTCSubscriber();

  // Initialize
  subscriber.init({
    protocol: 'wss',
    port: 8083,
    host: 'our.host.url',
    app: 'live',
    streamName: 'chosenStreamname',
    iceServers: [{urls: 'stun:stun2.l.google.com:19302'}],
    bandwidth: {
      audio: 56,
      video: 128
    }
  })
  .then(function(subscriber) {
    // `subcriber` is the WebRTC Subscriber instance.
    subscriber.subscribe();
  })
  .then(function(subscriber) {
    // subscription is complete.
    // playback should begin immediately due to
    //   declaration of `autoplay` on the `video` element.
  })
  .catch(function(error) {
    // A fault occurred while trying to initialize and playback the stream.
    console.error(error)
  });

})(window.red5prosdk);

The stream is neither working on iOS safari nor on android chrome. Does someone has experience with such an setup and can help?

Jonas Ostergaard
  • 319
  • 1
  • 12
  • Firstly you ensure that the publishing and subscribing are working properly on testbed example. The code is absolutely right. After that, we can come to this part and I will help you out from it asap. – Anoop Kumar Sep 28 '18 at 11:26

0 Answers0