1
我正在使用Xsocket和Xsocket WebRTC。爲什麼XSockets.WebRTC getUserMedia返回未定義?
爲什麼getUserMedia返回未定義?
這裏是我的consule輸出:
This appears to be Chrome
This appears to be Chrome
XSockets.WebRTC.latest.js:98
Connection
Object
ClientGuid: "80e0b08757ef429ea1e87c83e75295f5"
StorageGuid: "893c286b06f443c5b97f19c701fcde13"
clientType: "RFC6455"
__proto__: Object
default.html:18
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
MediaStream添加到PeerConnection等不確定
**Here is my full code:**
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="Scripts/jquery-1.9.0.js"></script>
<script src="Scripts/XSockets.latest.js"></script>
<script src="Scripts/adapter.js"></script>
<script src="Scripts/XSockets.WebRTC.latest.js"></script>
<script>
var conn = undefined;
var webRTC = undefined;
$(function() {
ws = new XSockets.WebSocket('ws://127.0.0.1:4502/Generic');
ws.subscribe(XSockets.Events.open, function (conn) {
console.log("Connection", conn)
});
webRTC = new XSockets.WebRTC(ws, {
onContextCreated: function (ctx) {
console.log("ctx", ctx);
},
onContextChange: function (changes) {
},
onLocalStream: function (stream) {
console.log("stream", stream);
attachMediaStream(document.querySelector("#localVideo"), stream);
},
onRemoteStream: function (stream) {
console.log("stream", stream);
attachMediaStream(document.querySelector("#remoteVideo"), stream);
}
});
$('#button-start').on('click', function() {
webRTC.getUserMedia({audio: true, video: true}, function (result) {
console.log("MediaStream is added to the PeerConnection" , result);
});
});
});
</script>
<title></title>
</head>
<body>
<button id="button-start">Start</button>
<video id="localVideo" autoplay />
<video id="remoteVideo" autoplay />
</body>
</html>