Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
86
rated 0 times [  90] [ 4]  / answers: 1 / hits: 17996  / 9 Years ago, wed, january 20, 2016, 12:00:00

I have a problem when use the HTML5 video tag and iconic.



Here is part of my template:



<ion-view>
<ion-content overflow-scroll=true data-tap-disable=true>
<div class=list card>
<div class=item item-body style=padding: 5% 5% 5% 5%>
<div class=player>
<video controls=controls autoplay id=sr></video>
</div>
</div>
</div>
</ion-content>
</ion-view>


Here is my controller:



.controller('viewVideoCtrl', function ($scope, $state, $stateParams) {
var videoPath = URL + uploadFiles + $stateParams.videoPath;

var videoObject = document.getElementById(sr);
videoObject.src = videoPath;
var webkitBeginFullScreen = function () {
alert(video has fullScreen!);
};

var onVideoEndsFullScreen = function () {
alert(fullScreen has end!);
};

videoObject.addEventListener('webkitbeginfullscreen', webkitBeginFullScreen, false);
videoObject.addEventListener('webkitendfullscreen', onVideoEndsFullScreen, false);
});


As you see there is no custom control button of video tag and use the default control bar which is created by the chromium itself.



Now I want to do something when the fullscreen button is pressed. I found a solution that add the two listener: webkitbeginfullscreen and webkitendfullscreen to the video object, but it not fired.


More From » html

 Answers
37

I am not sure about Android or iOS really, but the <video> element can use one of the following three events:




  • webkitfullscreenchange

  • mozfullscreenchange

  • fullscreenchange



and as far as the specification goes that's all you've got.



See this example or the following code:



function onFullScreen(e) {
var isFullscreenNow = document.webkitFullscreenElement !== null
alert('Fullscreen ' + isFullscreenNow)
}

document.getElementById(video).addEventListener('webkitfullscreenchange', onFullScreen)

[#63643] Monday, January 18, 2016, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sophiak

Total Points: 242
Total Questions: 90
Total Answers: 103

Location: Liechtenstein
Member since Wed, Dec 8, 2021
3 Years ago
;