我在页面中有多个视频,当我在离子框架中播放另一个视频时,我需要暂停视频

时间:2021-05-12 22:58:01

I have multiple videos in a page. I want to pause all other videos when I play a video in ionic framework.

我在一个页面中有多个视频。我想在离子框架中播放视频时暂停所有其他视频。

I am using not only you tube videos but also from other sources.

我不仅使用管视频,还使用其他来源。

part of my html page

我的HTML页面的一部分

<ion-list>
        <div class="card">
            <ion-item ng-repeat="module in co.Modules">
                  {{module.name}}
 <div class="video-container">

                   <iframe allowscriptaccess="always" ng-src="{{module.link}}" frameborder="0"  allowfullscreen></iframe>

                </div>
            </ion-item>
        </div>

<div class="col text-center">
<button class="button button-large button-positive" ng-click="vm.onclick(co.course_name)" >
   Take Assesment
</button>
</div>

</ion-list>

1 个解决方案

#1


0  

for this please use iframe in ionic my code is bellow.

为此请在离子中使用iframe我的代码如下。

HTML

 <div class="video-container">
    <iframe ng-src="{{getIframeSrc(videoNewsData.VIDEOSCRIPT)}}" frameborder="0" width="560" height="315" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
 </div>

Controller

$scope.getIframeSrc = function(videoId) {
    return $sce.trustAsResourceUrl('http://www.youtube.com/embed/' + videoId);
};

#1


0  

for this please use iframe in ionic my code is bellow.

为此请在离子中使用iframe我的代码如下。

HTML

 <div class="video-container">
    <iframe ng-src="{{getIframeSrc(videoNewsData.VIDEOSCRIPT)}}" frameborder="0" width="560" height="315" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
 </div>

Controller

$scope.getIframeSrc = function(videoId) {
    return $sce.trustAsResourceUrl('http://www.youtube.com/embed/' + videoId);
};