2016-07-27 4 views
0

cordova-plugin-opentokjs( https://www.npmjs.com/package/cordova-plugin-opentokjs cordova-plugin-iosrtcでiOS(9.3)で双方向ビデオチャットを実行しようとしています。私はcordova 6.3.0とOpenTok 2.8.1を使用しています。私が午前問題は、私がビデオを起動したときに、次のように私は、加入者のストリームからエラーを取得することです:OpenTok Cordovaエラー1013メディアリソースが適切でない

[Error] TypeError: undefined is not a constructor (evaluating 'new global.AudioContext()') 
[Error] OT.exception :: title: Connection Failed (1013) msg: OT.Subscriber PeerConnection Error: There was an unexpected problem with the Video Stream: The media resource indicated by the src attribute was not suitable. 
[Error] No message (2) 
[Error] OT.exception :: title: Unexpected Server Response (2001) msg: Unexpected server response. Try this operation again later. 

出版社のストリームが正常に動作します...少なくとも私は自分自身を見ることができます(ただし、他のユーザー私を見ることができない)。何か案は?ここで

は、いくつかの関連するコードです:

this.onDeviceReady = function() { 

    if (window.device.platform === 'iOS') { 
    cordova.plugins.iosrtc.registerGlobals(); 
    } 
}; 

そして私後藤ビデオページ私は(initializeSessionを呼び出す)します:

... 
initializePublisher: function() { 
    var self = this; 
    if (Globals.debug) 
    console.log("initializePublisher"); 

    if (!this.videoInputDevices || this.videoInputDevices.length === 0) 
    return; 

    var inputDevice = this.videoInputDevices[this.currentVideoDevice]; 
    if (!inputDevice || !inputDevice.deviceId) 
    return; 

    var $contianer = $('#openTokVideoContainer .mnOpenTokPublisherContainer'); 
    $contianer.empty(); 

    var $div = $('<div id="openTokPublisherStream"></div>'); 
    $contianer.append($div); 

    this.publisher = OT.initPublisher('openTokPublisherStream', { 
    width: '100%', 
    height: '100%', 
    fitMode: 'contain', 
    videoSource: inputDevice.deviceId, 
    mirror: (this.currentVideoDevice === 0) 
    }); 

    this.publisher.on('streamCreated', function(e) { 
    var stream = e.stream, 
     streamId = stream.streamId, 
     $div = $('#openTokVideoContainer .mnOpenTokPublisherContainer > *'); 

    $div.attr('data-stream', streamId); 
    console.log("Publisher stream: ", streamId); 
    }); 

    this.session.publish(this.publisher); 
}, 
initializeSession: function() { 
    var config = this.config, 
     self = this; 

    if (Globals.debug) 
    console.log("initializeSession"); 

    if (Globals.debug) 
    console.log("INIT SESSION " + config.sessionId + " TOKEN" + config.token); 

    this.session = OT.initSession(config.apiKey, config.sessionId); 
    this.session.on('streamCreated', function(e) { 
    var config = self.config; 
    if (Globals.debug) 
     console.log("onSessionConnected"); 

    self.subscribeToStream(e.stream, 'mnOpenTokSubscriberContainer'); 

    if (Globals.debug) 
     console.log("Stream created "); 
    }); 

    this.session.on('streamDestroyed', function(e) { 
    self.closeAllStreamSubscriptions(e.stream); 
    }); 

    this.session.connect(config.token, function (e) { 
    if (!self.publisher) { 
     self.getVideoDevices().then(function() { 
     self.initializePublisher(); 
     }); 
    } 
    }); 

    if (Globals.debug) 
    console.log("initializeSession"); 
},... 

ヘルプ?

編集:頭の多くは、など、更新のプラグイン、叩いた後、私は今、それは私に次のエラーを与えていない(と発表された映像は、もはや作品):

[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new t({type:"offer",sdp:l.content.sdp})') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] TypeError: undefined is not a constructor (evaluating 'new u(n.content)') 
[Error] OT.Publisher.onStreamAvailableError TypeError: Unknown Error while getting user media 
[Error] OT.exception :: title: Unable to Publish (1500) msg: GetUserMedia 
[Error] No message (2) 
[Error] No message (2) 
[Error] OT.exception :: title: Unexpected Server Response (2001) msg: Unexpected server response. Try this operation again later. 

答えて

0

私は問題があると思いますその時点でOpenTokライブラリがindex.htmlに含まれている場合、WebRTC APIはまだグローバルスコープに登録されていません。 OpenTokライブラリは、cordova.plugins.iosrtc.registerGlobals()の実行後にロードする必要があります。

は、動的にOpenTokライブラリをロードするためのindex.htmlで、本体の末尾に次のスクリプトを使用します。

<script type="text/javascript"> 
    document.addEventListener("deviceready", function(){ 
    // cordova-plugin-device provides the device object 
    if (device && device.platform === 'iOS') { 
     cordova.plugins.iosrtc.registerGlobals(); 
    } 

    // Insert OpenTok library after the device is ready 
    var s = document.createElement('script'); 
    s.setAttribute('src', 'https://static.opentok.com/v2/js/opentok.min.js'); 
    document.body.appendChild(s); 
    }, false); 
</script> 
関連する問題