Javascript 在Ionic应用程序中以横向全屏播放视频
我必须以全屏模式播放视频。请帮助我以全屏模式播放视频 我已经使用下面的代码在Ionic中查看模板Javascript 在Ionic应用程序中以横向全屏播放视频,javascript,html,cordova,ionic-framework,ionic,Javascript,Html,Cordova,Ionic Framework,Ionic,我必须以全屏模式播放视频。请帮助我以全屏模式播放视频 我已经使用下面的代码在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="contr
<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>
我在android设备中获得了以下输出
默认情况下,我希望输出如下所示:
您可以使用此插件来强制用户设备在打开视频时更改方向基于答案,下面是一个JavaScript实现,当用户在HTML元素上的交互触发文档全屏状态的更改时,打开和关闭方向锁
/** with CSS *//
height:100%;
margin-left: -50%
变量“element”应该是对JS中DOM、jQuery或angular元素的引用,在我的例子中,这是一个视频标记,但它可以是触发全屏更改的任何元素
element.on('webkitfullscreenchange mozfullscreenchange fullscreenchange', function(e) {
var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
if (isFullScreen) {
window.screen.unlockOrientation();
//alert("registered entered fullscreen and unlocked the orientation");
} else {
window.screen.lockOrientation('portrait')
//alert("registered exit fullscreen and locked the orientation to portrait again");
}
});
如果您正在使用ionic,则可以使用屏幕旋转->
你是否安装了在ionic framework中播放视频文件的插件除了媒体插件我没有使用任何插件我使用html5视频标签我尝试用你的代码在ionic framework中播放视频文件。。视频本身没有播放,这就是为什么我问你是否使用任何插件…你能把你的代码放在Github中吗请检查这里
element.on('webkitfullscreenchange mozfullscreenchange fullscreenchange', function(e) {
var isFullScreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
if (isFullScreen) {
window.screen.unlockOrientation();
//alert("registered entered fullscreen and unlocked the orientation");
} else {
window.screen.lockOrientation('portrait')
//alert("registered exit fullscreen and locked the orientation to portrait again");
}
});