2016-05-10 1 views
2

私はIonicを使ってアプリケーションを開発しており、ユーザーはビデオをアップロードできます。だからビデオを再生するために私はVideo.jsライブラリを統合しました。Video.js:フルスクリーンビデオを見ることができません

ビデオをフルスクリーンで再生しようとすると、フリッカーの問題が発生します。つまり、フルスクリーンボタンをタップ/クリックすると、100msの間フルスクリーンになり、通常の画面に戻ります。

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

だから私はこのちらつきの問題を解決するために何をすべきでしょうか?

答えて

0

これを試してください、それがあなたを助けてくれることを願っています。 player.requestFullscreen();

+0

私はそれを試しましたが、それはvideo要素にclickイベントを添付するときにのみ機能しています。 しかし、フルスクリーンのボタンでも同じことをすると、うまく動作せず、ちらつきが残っています。助けてくれてありがとう – Ricky

関連する問題