Commit a0d8d1c6 authored by likely's avatar likely

Initial commit

parent eca83b4e
......@@ -4,12 +4,10 @@
</head>
<body>
<!-- 正面摄像头 -->
<canvas id="front_video" width="480" height="860"></canvas>
<!-- 侧面摄像头 -->
<canvas id="side_video" width="480" height="860"></canvas>
<script src="//sqimg.qq.com/expert_qq/wawaji/TXWawaPlayer.beta4.min.js"></script>
<div id="lvb"></div>
<video wiDth="200" height="300" autoplay playsinline></video>
<video id="remoteVideo" autoplay playsinline></video>
<script src="https://imgcache.qq.com/open/qcloud/video/vcplayer/TcPlayer-2.2.1.js" charset="utf-8"></script>
<script src="index.js"></script>
</body>
......
......@@ -2,6 +2,17 @@ var insert = require('./utils/insertscript');
var ios = require('./libs/ios');
var android = require('./libs/android');
new TcPlayer('lvb', {
"m3u8": "http://14246.liveplay.myqcloud.com/live/14246_055dd098ab729831abff0c1f55536403.m3u8",
"autoplay": true, //iOS下safari浏览器是不开放这个能力的
"width": "100%",
"height": "100vh",
"wording": {
2032: "请求视频失败,请检查网络",
2048: "请求m3u8文件失败,可能是网络错误或者跨域问题"
}
});
var ua = window.navigator.userAgent.toLowerCase();
if (/iphone|ipad|ipod/gi.test(ua)) {
......
module.exports = function() {
console.log('android');
WebRTCAPI.init({
onInitResult: function(result) {
console.log("on init result : " + result);
if (result !== 0) {
var errorStr = "";
if (result === -10001) {
errorStr = "WebRTCJSAPI初始化参数不正确";
} else if (result === -10002) {
errorStr = "浏览器版本不正确";
} else if (result === -10003) {
errorStr = "sig校验失败";
} else if (result === -10006) {
errorStr = "WebSocket 初始化失败";
} else {
errorStr = "初始化错误";
}
console.log(errorStr);
} else {
//创建房间
WebRTCAPI.createRoom({
roomid: RoomNumber,
role: Role
}, onCreateRoomCallback);
}
},
onLocalStreamAdd: function(e) {
},
onRemoteStreamAdd: function(stream, videoId) {
var videoElement = document.getElementById("remoteVideo");
videoElement.srcObject = stream;
},
onRemoteStreamRemove: function(videoId) {
var videoElement = document.getElementById(videoId)
//特别注意,这里要把videoElement的srcObject置空
videoElement.srcObject = null
videoElement.parentNode.removeChild(videoElement)
},
onUpdateRemoteStream: function(stream, videoId, type, ssrState, openId) {
var videoElement = document.getElementById(videoId);
videoElement.parentNode.removeChild(videoElement)
//这里调用remotestreamadd的回调函数
onRemoteStreamAdd(stream, videoId, openId);
},
onKickout: function() {
alert("其他地方登录,被T下线")
},
onWebSocketClose: function() {
//断开后的处理
WebRTCAPI.quit();
},
onRelayTimeout: function(e) {
console.log(e)
},
onIceConnectionClose: function() {
},
onChangeRemoteStreamState: function() {
}
}, {
openid: "1574",
sdkAppId: 1400050371,
accountType: 19242,
userSig: "eJxFkFFPgzAUhf8LrzNyCytVEx-qYGQGE8fAZHtpKnTkOmEddAM0-neRjPh6vtyc79xvK4k2t1JrzIU0wq1z68EC62aMVaexVkLujaqHmFBKHYCJXlTd4LEagAOEEscF*IeYq8rgHsdDzjm9v4IGiyF5CdLFyk-t*LCLi26RaB9ksA6Lks1t8hSuGnnq4*VH28PsEpEy4xjw1t62Jf1iBN8*qyXwu-dot-UTrzinJx2Em3XCQxV3s*dX-jiV5Qcxbvuznw92FFxGrtBgqcZVxGOeS9lkKLPseK6MML1W4zN*fgGy2FYp"
})
}
\ No newline at end of file
module.exports = function() {
var ele1 = document.createElement('canvas')
ele1.id = 'front_video'
ele1.width = "480px"
ele1.height = "860px"
var ele2 = document.createElement('canvas')
ele2.id = 'side_video'
ele2.width = "480px"
ele2.height = "860px"
document.body.appendChild(ele1)
document.body.appendChild(ele2)
TXWawaVideo.init({
sdkappid: 1400050371,
accounttype: 19242,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment