fix off center button
This commit is contained in:
parent
1a4bc2a543
commit
391e2e25a2
1 changed files with 16 additions and 0 deletions
|
@ -564,12 +564,28 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
player.on('volumechange', onVolumeChange);
|
player.on('volumechange', onVolumeChange);
|
||||||
player.on('error', onError);
|
player.on('error', onError);
|
||||||
player.on('ended', onEnded);
|
player.on('ended', onEnded);
|
||||||
|
player.on('loadstart', function(){
|
||||||
|
console.log('LOADED HERE');
|
||||||
|
|
||||||
|
const playBT = document.getElementsByClassName('vjs-big-play-button')[0];
|
||||||
|
const videoDiv = player.children_[0];
|
||||||
|
const controlBar = document.getElementsByClassName('vjs-control-bar')[0];
|
||||||
|
const leftWidth = ((videoDiv.offsetWidth - playBT.offsetWidth) / 2) + 'px';
|
||||||
|
const availableHeight = videoDiv.offsetHeight - controlBar.offsetHeight;
|
||||||
|
const topHeight = (((availableHeight - playBT.offsetHeight) / 2) + 11) + 'px';
|
||||||
|
|
||||||
|
playBT.style.top = topHeight;
|
||||||
|
playBT.style.left = leftWidth;
|
||||||
|
playBT.style.margin = 0;
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
// on ios, show a play button when paused
|
// on ios, show a play button when paused
|
||||||
if (IS_IOS) {
|
if (IS_IOS) {
|
||||||
const playBT = document.getElementsByClassName('vjs-big-play-button')[0];
|
const playBT = document.getElementsByClassName('vjs-big-play-button')[0];
|
||||||
|
|
||||||
player.on('pause', function() {
|
player.on('pause', function() {
|
||||||
|
|
||||||
const videoDiv = player.children_[0];
|
const videoDiv = player.children_[0];
|
||||||
const controlBar = document.getElementsByClassName('vjs-control-bar')[0];
|
const controlBar = document.getElementsByClassName('vjs-control-bar')[0];
|
||||||
const leftWidth = ((videoDiv.offsetWidth - playBT.offsetWidth) / 2) + 'px';
|
const leftWidth = ((videoDiv.offsetWidth - playBT.offsetWidth) / 2) + 'px';
|
||||||
|
|
Loading…
Reference in a new issue