我有一个简单的视频标签,我想将自动播放中的选项更改为暂停和来回。
HTML:
<video webkit-playsinline {{playa}} loop ng-src="{{keeper}}" style="width:100%;height:100%;border:0px solid red;border-radius:100px;z-index:1;">
</video>
控制器:
$scope.play = function () {
$scope.playa=autoplay;
}
$scope.pause = function () {
$scope.playa=pause;
}
我会有两个按钮,暂停和播放,以执行每个功能 上面的代码不起作用,我不知道为什么。任何帮助将不胜感激!
来自网络控制台的错误:
Error: autoplay is not defined
@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/js/controllers.js:661:3
invoke@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:13282:14
instantiate@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:13290:27
$ControllerProvider/this.$get</<@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:17846:18
self.appendViewElement@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:52338:24
ionicViewSwitcher.create/switcher.render@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:50456:29
ionicViewSwitcher.create/switcher.init@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:50376:11
self.render@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:52198:5
self.register@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:52156:5
updateView@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:57577:11
.compile/</<@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:57554:11
$RootScopeProvider/this.$get</Scope.prototype.$broadcast@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:24997:15
transitionTo/$state.transition<@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:44841:11
processQueue@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:23399:28
scheduleProcessQueue/<@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:23415:27
$RootScopeProvider/this.$get</Scope.prototype.$eval@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:24678:16
$RootScopeProvider/this.$get</Scope.prototype.$digest@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:24489:15
$RootScopeProvider/this.$get</Scope.prototype.$apply@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:24783:13
timeout/timeoutId<@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:26550:25
completeOutstandingRequest@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:14226:7
Browser/self.defer/timeoutId<@file:///Users/MehdiNathani/Desktop/Celebrity%20Fitness/Celebrity%20Fitness/www/lib/ionic/js/ionic.bundle.js:14498:7
答案 0 :(得分:0)
我不知道是否可能,但无论如何错误是没有定义自动播放和暂停。现在,您要为playa分配autoplay的值,而不是字符串autoplay。 也许你会:
$ scope.playa ='autoplay';
和 $ scope.playa ='pause';