hackish change to get mute/volume reset working

This commit is contained in:
Jeremy Kauffman 2020-04-17 11:35:37 -04:00 committed by Sean Yesmunt
parent c89b69f6fc
commit ab74052446

View file

@ -78,6 +78,15 @@ function VideoViewer(props: Props) {
} }
function doTrackingFirstPlay(e: Event, data: any) { function doTrackingFirstPlay(e: Event, data: any) {
if (!embedded) {
if (muted) {
this.muted(muted);
}
if (volume) {
this.volume(volume);
}
}
analytics.videoStartEvent(claimId, data.secondsToLoad); analytics.videoStartEvent(claimId, data.secondsToLoad);
doAnalyticsView(uri, data.secondsToLoad).then(() => { doAnalyticsView(uri, data.secondsToLoad).then(() => {
@ -108,7 +117,7 @@ function VideoViewer(props: Props) {
setIsLoading(!embedded); // if we are here outside of an embed, we're playing setIsLoading(!embedded); // if we are here outside of an embed, we're playing
player.on('tracking:buffered', doTrackingBuffered); player.on('tracking:buffered', doTrackingBuffered);
player.on('tracking:firstplay', doTrackingFirstPlay); player.on('tracking:firstplay', doTrackingFirstPlay.bind(player));
player.on('ended', onEnded); player.on('ended', onEnded);
player.on('play', onPlay); player.on('play', onPlay);
player.on('pause', onPause); player.on('pause', onPause);
@ -124,16 +133,6 @@ function VideoViewer(props: Props) {
if (position) { if (position) {
player.currentTime(position); player.currentTime(position);
} }
// FIXME: below breaks rendering?!
/* if (!embedded) {
if (muted) {
player.muted(muted);
}
if (volume) {
player.volume(volume);
}
} */
}, []); }, []);
return ( return (