phonertc离子演示科尔多瓦未定义 [英] Phonertc ionic demo cordova is undefined

查看:105
本文介绍了phonertc离子演示科尔多瓦未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是ionic的新手,正在尝试在ionic平台上安装phonertc,但是当我运行该应用程序时,它对VideoViewDirective而言显示RefrenceError:cordova未定义.

I am a newbie with ionic and trying to install phonertc on ionic platform but when i run the app it shows for VideoViewDirective that RefrenceError: cordova is undefined.

VideoViewDirective.js

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);
  }
}
});

推荐答案

如果使用离子服务运行,则可能会显示cordova未定义.

If you are running using ionic serve, it is expected to show cordova is undefined.

如果要在浏览器中运行它,则应该

If you want to run it in browser, you should

ionic platform add browser
ionic run browser

然后,您将可以在浏览器中使用cordova的一部分.

Then you will be able to use part of cordova in your browser.

这篇关于phonertc离子演示科尔多瓦未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆