add allowPreRoll restrictions

This commit is contained in:
DispatchCommit 2021-07-07 13:15:59 -07:00
parent c02f253929
commit 6554e02622
2 changed files with 11 additions and 6 deletions

View file

@ -58,6 +58,7 @@ type Props = {
adUrl: ?string,
claimId: ?string,
userId: ?number,
allowPreRoll: ?boolean,
};
// type VideoJSOptions = {
@ -194,6 +195,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
adUrl,
claimId,
userId,
allowPreRoll,
} = props;
const [reload, setReload] = useState('initial');
@ -599,12 +601,14 @@ export default React.memo<Props>(function VideoJs(props: Props) {
// pre-roll ads
// This must be initialized earlier than everything else
// otherwise a race condition occurs if we place this in the onReady call back
// player.aniview();
vjs.ima({
// $FlowFixMe
vpaidMode: google.ima.ImaSdkSettings.VpaidMode.INSECURE,
adTagUrl: macroUrl,
});
if (allowPreRoll) {
// player.aniview();
vjs.ima({
// $FlowFixMe
vpaidMode: google.ima.ImaSdkSettings.VpaidMode.INSECURE,
adTagUrl: macroUrl,
});
}
// fixes #3498 (https://github.com/lbryio/lbry-desktop/issues/3498)
// summary: on firefox the focus would stick to the fullscreen button which caused buggy behavior with spacebar

View file

@ -345,6 +345,7 @@ function VideoViewer(props: Props) {
autoplay={!embedded || autoplayIfEmbedded}
claimId={claimId}
userId={userId}
allowPreRoll={!embedded && !authenticated}
/>
</React.Suspense>
)}