almost done but could still use some testing
This commit is contained in:
parent
b7e55296d5
commit
c6e6bd55e1
3 changed files with 33 additions and 35 deletions
|
@ -277,7 +277,6 @@ const analytics: Analytics = {
|
|||
videoType = passedPlayer.currentSource().type;
|
||||
videoPlayer = passedPlayer;
|
||||
bitrateAsBitsPerSecond = videoBitrate;
|
||||
|
||||
sendPromMetric('time_to_start', timeToStartVideo);
|
||||
},
|
||||
error: (message) => {
|
||||
|
@ -481,7 +480,7 @@ function sendPromMetric(name: string, value?: number) {
|
|||
let url = new URL(SDK_API_PATH + '/metric/ui');
|
||||
const params = { name: name, value: value ? value.toString() : '' };
|
||||
url.search = new URLSearchParams(params).toString();
|
||||
return fetch(url, { method: 'post' });
|
||||
return fetch(url, { method: 'post' }).catch(function(error){});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// @flow
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
const isDev = process.env.NODE_ENV !== 'production';
|
||||
|
||||
|
@ -17,7 +17,8 @@ const setLabel = (controlBar, childName, label) => {
|
|||
};
|
||||
|
||||
export default ({ tapToUnmuteRef, tapToRetryRef, setReload, videoTheaterMode,
|
||||
playerRef, autoplaySetting}) => {
|
||||
playerRef, autoplaySetting, player}) => {
|
||||
|
||||
// Override the player's control text. We override to:
|
||||
// 1. Add keyboard shortcut to the tool-tip.
|
||||
// 2. Override videojs' i18n and use our own (don't want to have 2 systems).
|
||||
|
@ -112,15 +113,15 @@ export default ({ tapToUnmuteRef, tapToRetryRef, setReload, videoTheaterMode,
|
|||
// }
|
||||
// }, [adUrl]);
|
||||
|
||||
useEffect(() => {
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
const controlBar = player.getChild('controlBar');
|
||||
controlBar
|
||||
.getChild('TheaterModeButton')
|
||||
.controlText(videoTheaterMode ? __('Default Mode (t)') : __('Theater Mode (t)'));
|
||||
}
|
||||
}, [videoTheaterMode]);
|
||||
// useEffect(() => {
|
||||
// const player = playerRef.current;
|
||||
// if (player) {
|
||||
// const controlBar = player.getChild('controlBar');
|
||||
// controlBar
|
||||
// .getChild('TheaterModeButton')
|
||||
// .controlText(videoTheaterMode ? __('Default Mode (t)') : __('Theater Mode (t)'));
|
||||
// }
|
||||
// }, [videoTheaterMode]);
|
||||
|
||||
// when user clicks 'Unmute' button, turn audio on and hide unmute button
|
||||
function unmuteAndHideHint() {
|
||||
|
@ -172,24 +173,24 @@ export default ({ tapToUnmuteRef, tapToRetryRef, setReload, videoTheaterMode,
|
|||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
console.log('RUNNING HERE!')
|
||||
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
const touchOverlay = player.getChild('TouchOverlay');
|
||||
const controlBar = player.getChild('controlBar') || touchOverlay.getChild('controlBar');
|
||||
const autoplayButton = controlBar.getChild('AutoplayNextButton');
|
||||
|
||||
if (autoplayButton) {
|
||||
const title = autoplaySetting ? __('Autoplay Next On') : __('Autoplay Next Off');
|
||||
|
||||
autoplayButton.controlText(title);
|
||||
autoplayButton.setAttribute('aria-label', title);
|
||||
autoplayButton.setAttribute('aria-checked', autoplaySetting);
|
||||
}
|
||||
}
|
||||
}, [autoplaySetting]);
|
||||
// useEffect(() => {
|
||||
// console.log('RUNNING HERE!')
|
||||
//
|
||||
// const player = playerRef.current;
|
||||
// if (player) {
|
||||
// const touchOverlay = player.getChild('TouchOverlay');
|
||||
// const controlBar = player.getChild('controlBar') || touchOverlay.getChild('controlBar');
|
||||
// const autoplayButton = controlBar.getChild('AutoplayNextButton');
|
||||
//
|
||||
// if (autoplayButton) {
|
||||
// const title = autoplaySetting ? __('Autoplay Next On') : __('Autoplay Next Off');
|
||||
//
|
||||
// autoplayButton.controlText(title);
|
||||
// autoplayButton.setAttribute('aria-label', title);
|
||||
// autoplayButton.setAttribute('aria-checked', autoplaySetting);
|
||||
// }
|
||||
// }
|
||||
// }, [autoplaySetting]);
|
||||
|
||||
// Add various event listeners to player
|
||||
player.one('play', onInitialPlay);
|
||||
|
|
|
@ -186,10 +186,8 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
|||
|
||||
const videoJsEvents = events({ tapToUnmuteRef, tapToRetryRef, setReload, videoTheaterMode, playerRef, autoplaySetting, player });
|
||||
|
||||
unmuteAndHideHint = { events };
|
||||
retryVideoAfterFailure = { events };
|
||||
|
||||
videoJsEvents.initializeEvents({ player, tapToRetryRef, tapToUnmuteRef });
|
||||
unmuteAndHideHint = videoJsEvents.unmuteAndHideHint;
|
||||
retryVideoAfterFailure = videoJsEvents.retryVideoAfterFailure;
|
||||
|
||||
// Replace volume bar with custom LBRY volume bar
|
||||
LbryVolumeBarClass.replaceExisting(player);
|
||||
|
|
Loading…
Reference in a new issue