【发布时间】:2016-11-25 02:09:45
【问题描述】:
我正在尝试在sails 应用程序中使用onsip 的以下JavaScript 代码来应用视频通话,但它给出了错误:
无法读取 null 的属性 addEventListener'
下面是它的 JavaScript 代码:
button.addEventListener('click', function() {
// Was on a call, so the button press means we are hanging up
if (onCall) {
onCall = false;
button.firstChild.nodeValue = 'video';
remoteRender.style.visibility = 'hidden';
session.bye();
session = null;
}
// Was not on a call, so the button press means we are ringing someone
else {
onCall = true;
button.firstChild.nodeValue = 'hang up';
remoteRender.style.visibility = 'visible';
session = makeCall(userAgent, target,
false, true,
remoteRender, null);
session.on('bye', function() {
onCall = false;
button.firstChild.nodeValue = 'video';
remoteRender.style.visibility = 'hidden';
session = null;
});
}
});
上面的HTML代码是:
<button id="alice-video-button" class="right" type="button">video</button>
【问题讨论】:
标签: javascript angularjs node.js sails.js