我是 ionic 的新手,并试图在 ionic 平台上安装 phonertc,但是当我运行该应用程序时,它会为 VideoViewDirective 显示 RefrenceError: cordova 未定义。
VideoViewDirective.js
angular.module('phonertcdemo')
.directive('videoView', function ($rootScope, $timeout) {
return {
restrict: 'E',
template: '<div class="video-container"></div>',
replace: true,
link: function (scope, element, attrs) {
function updatePosition() {
cordova.plugins.phonertc.setVideoView({
container: element[0],
local: {
position: [240, 240],
size: [50, 50]
}
});
}
$timeout(updatePosition, 500);
$rootScope.$on('videoView.updatePosition', updatePosition);
}
}
});