在 Ionic 应用程序中全屏横向播放视频

2024-01-01

我在播放视频横向全屏模式时遇到问题。请帮助我以横向全屏模式显示视频。

我使用以下代码在 Ionic 中查看模板。

<ion-view view-title="Poem" hide-nav-bar="true">
    <div class="modal transparent fullscreen-player">
          <video id="myvideo" ng-src="{{clipSrc}}" class="centerme" controls="controls" autoplay poster="{{bg}}"></video>
    </div>
</ion-view>

控制器代码如下:

.controller('PoemDetailCtrl', function($scope) {
      $scope.clipSrc = '/android_asset/www/video/demo.mp4'
      $scope.bg = 'img/poems/01.png';
      var video = document.getElementById("myvideo");
      if (video.requestFullscreen) {
        video.requestFullscreen();
      } else if (video.msRequestFullscreen) {
        video.msRequestFullscreen();
      } else if (video.mozRequestFullScreen) {
        video.mozRequestFullScreen();
      } else if (video.webkitRequestFullscreen) {
        video.webkitRequestFullscreen();
      }
})

我在 Android 设备中得到以下输出

我想默认输出如下:


https://github.com/gbenvenuti/cordova-plugin-screen-orientation https://github.com/gbenvenuti/cordova-plugin-screen-orientation

您可以使用此插件来强制用户设备在打开视频时改变方向

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 Ionic 应用程序中全屏横向播放视频 的相关文章

随机推荐