AngularJS ionic - 尝试播放视频时iframe出错

时间:2016-09-23 20:45:19

标签: javascript html angularjs ionic-framework

这些是我的错误:Error: [$interpolate:interr] Can't interpolate: {{ videourl }} Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy.

Error: [$interpolate:interr] Can't interpolate: {{ videourl }} Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy.

当我添加我从研究中得到的代码时......

$sceDelegateProvider.resourceUrlWhitelist([
  'self',   
  'http://tvstartup.biz/**']);
  $scope.trustSrc = function(src) {
    return $sce.trustAsResourceUrl(src);
  }

...我收到此错误:

 `ReferenceError: $sceDelegateProvider is not defined at new <anonymous> (/js/app.js:295:1) at Object.instantiate (/lib/ionic/js/ionic.bundle.js:18010:14) at $controller (/lib/ionic/js/ionic.bundle.js:23412:28) at self.appendViewElement (/lib/ionic/js/ionic.bundle.js:59900:24) at Object.render (/lib/ionic/js/ionic.bundle.js:57893:41) at Object.init (/lib/ionic/js/ionic.bundle.js:57813:20) at self.render (/lib/ionic/js/ionic.bundle.js:59759:14) at self.register (/lib/ionic/js/ionic.bundle.js:59717:10) at updateView (/lib/ionic/js/ionic.bundle.js:65398:23) at /lib/ionic/js/ionic.bundle.js:65382:9 <ion-nav-view name="side-menu21" class="view-container" nav-view-transition="ios">`

这是我的代码: JS

 .controller('WatchController', ['$scope', '$http', '$state', '$stateParams', '$location', '$sce', function ($scope, $http, $state, $stateParams, $sce) {
    $scope.title = 'Air 247';
    $scope.apiusername = '?';
    $scope.apipassword = '?';
    $scope.waid = $stateParams.wId;
$sceDelegateProvider.resourceUrlWhitelist([
  'self',   
  'http://tvstartup.biz/**']);
  $scope.trustSrc = function(src) {
    return $sce.trustAsResourceUrl(src);
  }
$scope.videourl = 'http://tvstartup.biz/mng-channel/vpanel/vod.php?token=c177083f3e6b9c913a691e28ce92f799&id=' + $scope.waid;

}])

HTML

<iframe ng-src="{{ videourl }}" seamless="seamless"  scrolling="no" frameBorder="0" allowfullscreen width="960" height="470" > </iframe>

我想要它做的是播放iframe中的视频,但我不断收到这些错误。我也尝试将id传递给ng-src,但它没有用,我仍然得到与前2名相同的错误。

0 个答案:

没有答案