WebRTC Red5Pro无法在移动浏览器上运行

时间:2017-11-10 16:16:09

标签: android webrtc hybrid-mobile-app sdp red5pro

我试图在适用于iOS和Android的cordova混合应用程序中包含流媒体服务。我们之所以选择red5pro是因为它是用户情况的1个广播公司,因此我们需要一个向用户广播的服务器。广播只是通过笔记本电脑上的webbrowser完成,没有问题,但接收将在应用程序内部。

red5pro有3个用于HTML流媒体的示例用例,原生Android和原生iOS。我们正在开发混合移动应用程序,因此我们选择了HTML方法。

我们做了一个测试设置,你可以在任何webbrowser中打开一个URL,然后看看steam,它在firefox,chrome和safari上运行正常。但是,如果我们尝试在Android设备上通过chrome打开流,我们会收到以下错误消息:

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.

"无效的SDP"在完成对流的订阅后出现此消息。

我的客户端示例代码: 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>

和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);

该流既不适用于iOS safari也不适用于Android chrome。有人有这种设置的经验并可以提供帮助吗?

0 个答案:

没有答案