[英]Phonertc ionic demo cordova is undefined
我是 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);
}
}
});
我剛開始時遇到了同樣的問題。 我確保將 com.dooble.phonert 聲明為插件。 然后,我只在我的 index.html 中引用了cordova.js。
希望這可以幫助。
如果您使用 ionic serve 運行,預計會顯示 cordova 未定義。
如果你想在瀏覽器中運行它,你應該
ionic platform add browser
ionic run browser
然后您就可以在瀏覽器中使用部分cordova。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.