Answer the question
In order to leave comments, you need to log in
Track the esc event when exiting the full screen video mode, how to do?
using the videojs.com library, I
made my own player, when you click on the button, the full-screen mode changes the length of the playback track, when you click again, it exits the full-screen mode and the track length becomes the same.
Pressing esc exits full screen mode, but the track length remains the same as for full screen mode. So how do you track the esc event?
I used this code, for some reason it works outside of full-screen mode, and when viewed in full-screen mode, only the transition to normal video mode function works.
var bar = true;
function resizepro() {
$('.video-js').click(function() {
$('.vjs-fullscreen-control').addClass('dlinabara');
$('.dlinabara').click(function() {
if(bar) {
$('.vjs-progress-control').css('width','78%');
$('.vjs-current-time').css('margin','-1px 10px 0px 80%');
bar = false;
}
else{
$('.vjs-progress-control').css('width','375px');
$('.vjs-current-time').css('margin','-1px 10px 0px 387px');
bar = true;
}
});
$(document).keydown(function() {
$('.vjs-progress-control').css('width','375px');
$('.vjs-current-time').css('margin','-1px 10px 0px 387px');
bar = true;
});
});
}
Answer the question
In order to leave comments, you need to log in
It's probably better to use the video.js API and subscribe to the fullscreenchange event , in the handler of which it is already necessary to change the track width.
I haven't worked with videojs, but the event subscription code looks something like this:
videojs("video-selector").ready(function() {
this.on("fullscreenchange", function() {
// код изменения ширины дорожки
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question