问题描述
我正在尝试使用 AntMedia 实现直播,所以我有这个 Angular 10 项目,我需要在其中导入 webrtc_adaptor.js。
我的 webrtc_adaptor.js 是这样开始的:
function WebRTCAdaptor(initialValues)
{
class PeerStats {
constructor(streamId) {
this.streamId = streamId;
this.totalBytesReceivedCount = 0;
this.totalBytesSent = 0;
this.packetsLost = 0;
this.fractionLost = 0;
this.startTime = 0;
this.lastBytesReceived = 0;
this.lastBytesSent = 0;
this.currentTimestamp = 0;
this.lastTime = 0;
this.timerId = 0;
this.firstByteSentCount = 0;
this.firstBytesReceivedCount = 0;
this.audioLevel = -1;
}
}
为了导入,我在 angular.json 中添加了以下行:
"scripts": [
"src/main/webapp/app/entities/master/livestream/video/webrtc_adaptor.js"
]
在我的 Angular 组件中添加:
declare let WebRTCAdaptor: any;
在我的课堂上,我补充说:
webRTCAdaptor: any;
this.webRTCAdaptor = new WebRTCAdaptor({
websocket_url : "wss://your_server_url:5443/WebRTCAppEE/websocket",mediaConstraints : mediaConstraints,peerconnection_config : pc_config,sdp_constraints : sdpConstraints,remoteVideoId : "remoteVideo",isPlayMode: true,debug: true,callback : function(info,description)
});
我基于 AntMedia manual 来执行此操作,毕竟我仍然收到以下错误:
ERROR ReferenceError: WebRTCAdaptor is not defined
at VideoComponent.startLive (video.component.ts?a313:85)
at VideoComponent.onSuccess (video.component.ts?a313:110)
at SafeSubscriber.eval [as _next] (video.component.ts?a313:78)
at SafeSubscriber.__tryOrUnsub (Subscriber.js?ee8f:183)
at SafeSubscriber.next (Subscriber.js?ee8f:122)
at Subscriber._next (Subscriber.js?ee8f:72)
at Subscriber.next (Subscriber.js?ee8f:49)
at MapSubscriber._next (map.js?949c:35)
at MapSubscriber.next (Subscriber.js?ee8f:49)
at FilterSubscriber._next (filter.js?a4b6:33)
有人能帮我发现我做错了什么吗?
谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)