javascript - 在 Ionic App 中以横向全屏播放视频

标签 javascript html cordova ionic-framework

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

我使用以下代码在 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 代码如下:

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

我在安卓设备上得到了以下输出

enter image description here

我想默认输出如下:

enter image description here

最佳答案

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

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

关于javascript - 在 Ionic App 中以横向全屏播放视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32247407/

相关文章:

javascript - 当浏览器关闭时,是否有一种可靠的方法来注销用户?

javascript - 查找属性是否在脚本标签内

html - 内容取决于另一个 <div> 下 <div> 的宽度

Javascript将变量写入div

javascript - 如何在jquery中以编程方式选择可选择的项目?

HTML5 <img> 标签替代图片

javascript - Cordova 错误 : Refused to execute inline script because it violates the following Content Security Policy directive

ios - Cordova - ios 按需资源

android - 上传到 TLS 环境时使用 Cordova 的 FileTransfer API 时出错

javascript - 无法将动态 id 添加到 jquery 元素