gpt4 book ai didi

javascript - 视频.js : Unable to view fullscreen video

转载 作者:行者123 更新时间:2023-11-30 00:09:23 24 4
gpt4 key购买 nike

我正在使用 Ionic 开发一个应用程序,我允许用户上传视频。因此,为了播放视频,我集成了 Video.js 库。

但是,当我尝试全屏播放视频时,我遇到了闪烁问题,即当我点击/单击全屏按钮时,它会全屏播放大约 100 毫秒,然后返回正常屏幕。

Video.html

<ion-view view-title="Video">
<ion-content class="padding">
<input type="file" name="file" accept="video/*;capture=camera" tg-file-select id="fileSelect">
<h3>Upload Video</h3>
<video class="video-js vjs-default-skin vjs-big-play-centered" width="640" height="240" videojs></video>
<div class="row">
<button type="button" class="button button-assertive" ng-click="uploadVideo()" style="margin: auto;">Upload Video</button>
</div>
</ion-content>
</ion-view>

Videojs 指令

(function() {
'use strict';
angular.module('starter')
.directive('videojs', function($sce) {
var linker = function(scope, element, attrs) {
var player;
attrs.type = attrs.type || "video/mp4";

var setup = {
'techOrder': ['html5', 'flash'],
'controls': true,
'preload': 'auto',
'autoplay': false,
'fluid': true
};

attrs.id = "aboutmeVideo";
element.attr('id', attrs.id);
player = videojs(attrs.id, setup, function() {
var source = { type: "video/mp4", src: $sce.trustAsResourceUrl("someFileURL") };

this.src({ type: attrs.type, src: source.src });
});

$('button.vjs-fullscreen-control').on('click', function(e) {
e.preventDefault();
console.log('FullScreen Clicked');
player = videojs('aboutmeVideo');
if (player.isFullscreen()) {
player.exitFullscreen();
} else {
player.requestFullscreen();
}
});
scope.$on('NEW_VIDEO', function(event, videoURL) {
videojs('aboutmeVideo').src({ type: 'video/mp4', src: videoURL });
});
};
return {
restrict: 'A',
link: linker
};
});
})();

那么我应该怎么做才能解决这个闪烁的问题呢?

最佳答案

试试这个,希望对你有帮助。 player.requestFullscreen();

关于javascript - 视频.js : Unable to view fullscreen video,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37129107/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com