我在播放视频横向全屏模式时遇到问题。请帮助我以横向全屏显示视频。
我使用以下代码在 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();
}
})
我在安卓设备上得到了以下输出
我想默认输出如下:
最佳答案
https://github.com/gbenvenuti/cordova-plugin-screen-orientation
您可以使用这个插件来强制用户设备在打开视频时改变方向
关于javascript - 在 Ionic App 中以横向全屏播放视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32247407/