style fixes
This commit is contained in:
parent
df4ff30c83
commit
dd4cd9314c
3 changed files with 44 additions and 46 deletions
|
@ -120,6 +120,9 @@ function SideNavigation(props: Props) {
|
||||||
...buildLink(PAGES.LIBRARY, __('Library'), ICONS.LIBRARY),
|
...buildLink(PAGES.LIBRARY, __('Library'), ICONS.LIBRARY),
|
||||||
},
|
},
|
||||||
// @endif
|
// @endif
|
||||||
|
{
|
||||||
|
...(expanded ? { ...buildLink(PAGES.SETTINGS, __('Settings'), ICONS.SETTINGS) } : {}),
|
||||||
|
},
|
||||||
].map(
|
].map(
|
||||||
linkProps =>
|
linkProps =>
|
||||||
linkProps.navigate && (
|
linkProps.navigate && (
|
||||||
|
@ -164,9 +167,6 @@ function SideNavigation(props: Props) {
|
||||||
{
|
{
|
||||||
...buildLink(PAGES.PUBLISH, __('Publish'), ICONS.PUBLISH),
|
...buildLink(PAGES.PUBLISH, __('Publish'), ICONS.PUBLISH),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
...buildLink(PAGES.SETTINGS, __('Settings'), ICONS.SETTINGS),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
...buildLink(PAGES.HELP, __('Help'), ICONS.HELP),
|
...buildLink(PAGES.HELP, __('Help'), ICONS.HELP),
|
||||||
},
|
},
|
||||||
|
|
|
@ -57,7 +57,6 @@ function VideoViewer(props: Props) {
|
||||||
} = props;
|
} = props;
|
||||||
const claimId = claim && claim.claim_id;
|
const claimId = claim && claim.claim_id;
|
||||||
const isAudio = contentType.includes('audio');
|
const isAudio = contentType.includes('audio');
|
||||||
|
|
||||||
const forcePlayer = FORCE_CONTENT_TYPE_PLAYER.includes(contentType);
|
const forcePlayer = FORCE_CONTENT_TYPE_PLAYER.includes(contentType);
|
||||||
const [isPlaying, setIsPlaying] = useState(false);
|
const [isPlaying, setIsPlaying] = useState(false);
|
||||||
const [showAutoplayCountdown, setShowAutoplayCountdown] = useState(false);
|
const [showAutoplayCountdown, setShowAutoplayCountdown] = useState(false);
|
||||||
|
@ -85,7 +84,6 @@ function VideoViewer(props: Props) {
|
||||||
|
|
||||||
function doTrackingFirstPlay(e: Event, data: any) {
|
function doTrackingFirstPlay(e: Event, data: any) {
|
||||||
analytics.videoStartEvent(claimId, data.secondsToLoad);
|
analytics.videoStartEvent(claimId, data.secondsToLoad);
|
||||||
|
|
||||||
doAnalyticsView(uri, data.secondsToLoad).then(() => {
|
doAnalyticsView(uri, data.secondsToLoad).then(() => {
|
||||||
claimRewards();
|
claimRewards();
|
||||||
});
|
});
|
||||||
|
@ -110,54 +108,48 @@ function VideoViewer(props: Props) {
|
||||||
setIsPlaying(false);
|
setIsPlaying(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const onPlayerReady = useCallback((player: Player) => {
|
const onPlayerReady = useCallback(
|
||||||
if (!embedded) {
|
(player: Player) => {
|
||||||
player.muted(muted);
|
if (!embedded) {
|
||||||
player.volume(volume);
|
player.muted(muted);
|
||||||
}
|
player.volume(volume);
|
||||||
|
}
|
||||||
|
|
||||||
const shouldPlay = !embedded || autoplayIfEmbedded;
|
const shouldPlay = !embedded || autoplayIfEmbedded;
|
||||||
// https://blog.videojs.com/autoplay-best-practices-with-video-js/#Programmatic-Autoplay-and-Success-Failure-Detection
|
// https://blog.videojs.com/autoplay-best-practices-with-video-js/#Programmatic-Autoplay-and-Success-Failure-Detection
|
||||||
if (shouldPlay) {
|
if (shouldPlay) {
|
||||||
const playPromise = player.play();
|
const playPromise = player.play();
|
||||||
const timeoutPromise = new Promise((resolve, reject) => {
|
const timeoutPromise = new Promise((resolve, reject) => {
|
||||||
setTimeout(() => reject(PLAY_TIMEOUT_ERROR), 1000);
|
setTimeout(() => reject(PLAY_TIMEOUT_ERROR), 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
Promise.race([playPromise, timeoutPromise]).catch(error => {
|
Promise.race([playPromise, timeoutPromise]).catch(error => {
|
||||||
if (error === PLAY_TIMEOUT_ERROR) {
|
|
||||||
// The player promise hung
|
|
||||||
// This is probably in firefox
|
|
||||||
// The second attempt usually works
|
|
||||||
player.play();
|
|
||||||
} else {
|
|
||||||
// Autoplay was actually blocked by the browser
|
|
||||||
// Reset everything so the user sees the thumbnail/play button and can start it on their own
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
setIsPlaying(false);
|
setIsPlaying(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsLoading(shouldPlay); // if we are here outside of an embed, we're playing
|
||||||
|
player.on('tracking:buffered', doTrackingBuffered);
|
||||||
|
player.on('tracking:firstplay', doTrackingFirstPlay);
|
||||||
|
player.on('ended', onEnded);
|
||||||
|
player.on('play', onPlay);
|
||||||
|
player.on('pause', onPause);
|
||||||
|
player.on('volumechange', () => {
|
||||||
|
if (player && player.volume() !== volume) {
|
||||||
|
changeVolume(player.volume());
|
||||||
|
}
|
||||||
|
if (player && player.muted() !== muted) {
|
||||||
|
changeMute(player.muted());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
setIsLoading(shouldPlay); // if we are here outside of an embed, we're playing
|
if (position) {
|
||||||
player.on('tracking:buffered', doTrackingBuffered);
|
player.currentTime(position);
|
||||||
player.on('tracking:firstplay', doTrackingFirstPlay);
|
|
||||||
player.on('ended', onEnded);
|
|
||||||
player.on('play', onPlay);
|
|
||||||
player.on('pause', onPause);
|
|
||||||
player.on('volumechange', () => {
|
|
||||||
if (player && player.volume() !== volume) {
|
|
||||||
changeVolume(player.volume());
|
|
||||||
}
|
}
|
||||||
if (player && player.muted() !== muted) {
|
},
|
||||||
changeMute(player.muted());
|
[uri]
|
||||||
}
|
);
|
||||||
});
|
|
||||||
|
|
||||||
if (position) {
|
|
||||||
player.currentTime(position);
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -343,7 +343,6 @@
|
||||||
.vjs-big-play-button {
|
.vjs-big-play-button {
|
||||||
@extend .button--icon;
|
@extend .button--icon;
|
||||||
@extend .button--play;
|
@extend .button--play;
|
||||||
background-color: rgba(0, 0, 0, 0.6);
|
|
||||||
border: none;
|
border: none;
|
||||||
position: static;
|
position: static;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
@ -359,6 +358,13 @@
|
||||||
.video-js.vjs-paused {
|
.video-js.vjs-paused {
|
||||||
.vjs-big-play-button {
|
.vjs-big-play-button {
|
||||||
display: block;
|
display: block;
|
||||||
|
background-color: rgba(0, 0, 0, 0.6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-js:hover {
|
||||||
|
.vjs-big-play-button {
|
||||||
|
background-color: var(--color-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue