Add play button on pause ios #6975

Closed
mayeaux wants to merge 4 commits from add-play-button-on-pause-ios into master
Showing only changes of commit 90369e8d9b - Show all commits

View file

@ -59,7 +59,7 @@ type Props = {
userId: ?number, userId: ?number,
// allowPreRoll: ?boolean, // allowPreRoll: ?boolean,
shareTelemetry: boolean, shareTelemetry: boolean,
showAutoplayCountdown: boolean showAutoplayCountdown: boolean,
}; };
// type VideoJSOptions = { // type VideoJSOptions = {
@ -566,19 +566,19 @@ export default React.memo<Props>(function VideoJs(props: Props) {
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';
const availableHeight = videoDiv.offsetHeight - controlBar.offsetHeight; const availableHeight = videoDiv.offsetHeight - controlBar.offsetHeight;
const topHeight = (((availableHeight - playBT.offsetHeight) / 2) + 3) + 'px'; const topHeight = (availableHeight - playBT.offsetHeight) / 2 + 3 + 'px';
playBT.style.top = topHeight; playBT.style.top = topHeight;
playBT.style.left = leftWidth; playBT.style.left = leftWidth;
playBT.style.margin = 0; playBT.style.margin = '0';
}); });
player.on('ended', function() { player.on('ended', function () {
if (showAutoplayCountdown) { if (showAutoplayCountdown) {
playBT.style.display = 'none'; playBT.style.display = 'none';
} }