加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.html 3.88 KB
一键复制 编辑 原始数据 按行查看 历史
root 提交于 2017-12-12 22:08 . init
<!doctype html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=Edge"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0"/>
<title>IM-DEMO</title>
<!-- HTML5 element -->
<script src="./demo/javascript/dist/browser-polyfill.min.js"></script>
</head>
<body>
<div id="rtCall" style="width: 50px;height: 50px; background: #ccc;display: inline-block;">call</div>
<div id="rtAcceptCall" style="width: 50px;height: 50px; background: #ccc;display: inline-block;">receive</div>
<div id="rtEndCall" style="width: 50px;height: 50px; background: #ccc;display: inline-block;">end</div>
<section id='main' class='w100'>
<article id='demo'></article>
<article id='components'></article>
</section>
<!--config-->
<script src="./demo/javascript/dist/webim.config.js"></script>
<script>
if (WebIM.config.isWindowSDK) {
document.title = "环信Demo";
}
if (WebIM.config.isDebug) {
document.write("<script src='./sdk/dist/strophe-1.2.8.js'><\/script>");
} else {
<!--A JavaScript library for XMPP over Websocket-->
document.write("<script src='./sdk/dist/strophe-1.2.8.min.js'><\/script>");
}
</script>
<!--sdk-->
<script src='./sdk/dist/websdk-1.4.13.js'></script>
<!--webrtc-->
<script>
if (WebIM.config.isWebRTC) {
document.write("<script src='./webrtc/dist/adapter.js'><\/script>");
document.write("<script src='./webrtc/dist/webrtc-1.4.13.js'><\/script>");
}
console.log(WebIM.config);
</script>
<!--[if lte IE 9]>
<script src="./demo/javascript/dist/swfupload/swfupload.min.js"></script>
<![endif]-->
<!--demo javascript-->
<script src="./demo/javascript/dist/demo-1.4.13.js"></script>
<!--script type="text/javascript">
var rtcCall = new WebIM.WebRTC.Call({
connection: conn,
mediaStreamConstaints: {
audio: true,
video: false
},
listener: {
onAcceptCall: function (from, options) {
console.log('onAcceptCall::', 'from: ', from, 'options: ', options);
},
//通过streamType区分视频流和音频流,streamType: 'VOICE'(音频流),'VIDEO'(视频流)
onGotRemoteStream: function (stream, streamType) {
console.log('onGotRemoteStream::', 'stream: ', stream, 'streamType: ', streamType);
var video = document.getElementById('video');
video.srcObject = stream;
},
onGotLocalStream: function (stream, streamType) {
console.log('onGotLocalStream::', 'stream:', stream, 'streamType: ', streamType);
var video = document.getElementById('localVideo');
video.srcObject = stream;
},
onRinging: function (caller) {
console.log('onRinging::', 'caller:', caller);
},
onTermCall: function (reason) {
console.log('onTermCall::');
console.log('reason:', reason);
},
onIceConnectionStateChange: function (iceState) {
console.log('onIceConnectionStateChange::', 'iceState:', iceState);
},
onError: function (e) {
console.log(e);
}
}
});
/*var call = function () {
rtcCall.caller = 'mengyuanyuan';
rtcCall.makeVideoCall('asdfghj');
};*/
// 音频呼叫对方
var call = function () {
rtcCall.caller = 'zieman';
rtcCall.makeVoiceCall('kuyadur');
};
// 关掉/拒绝视频
var endCall = function () {
rtcCall.endCall();
};
// 接受对方呼叫
var acceptCall = function () {
rtcCall.acceptCall();
};
document.getElementById('rtCall').onclick = call;
document.getElementById('rtEndCall').onclick = endCall;
document.getElementById('rtAcceptCall').onclick = acceptCall;
</script-->
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化