improve autoplay on chrome
This commit is contained in:
parent
8ae5a76463
commit
613c8f7a10
1 changed files with 8 additions and 4 deletions
|
@ -21,7 +21,6 @@ const SEEK_BACKWARD_KEYCODE = ARROW_LEFT_KEYCODE;
|
||||||
const SEEK_STEP = 10; // time to seek in seconds
|
const SEEK_STEP = 10; // time to seek in seconds
|
||||||
|
|
||||||
const VIDEO_JS_OPTIONS: { poster?: string } = {
|
const VIDEO_JS_OPTIONS: { poster?: string } = {
|
||||||
autoplay: true,
|
|
||||||
controls: true,
|
controls: true,
|
||||||
preload: 'auto',
|
preload: 'auto',
|
||||||
playbackRates: [0.25, 0.5, 0.75, 1, 1.1, 1.25, 1.5, 2],
|
playbackRates: [0.25, 0.5, 0.75, 1, 1.1, 1.25, 1.5, 2],
|
||||||
|
@ -112,9 +111,14 @@ function VideoViewer(props: Props) {
|
||||||
|
|
||||||
if (!requireRedraw) {
|
if (!requireRedraw) {
|
||||||
player = videojs(videoNode, videoJsOptions, function() {
|
player = videojs(videoNode, videoJsOptions, function() {
|
||||||
const self = this;
|
player.volume(volume);
|
||||||
self.volume(volume);
|
player.muted(muted);
|
||||||
self.muted(muted);
|
player.ready(() => {
|
||||||
|
// In the future this should be replaced with something that checks if the
|
||||||
|
// video is actually playing after calling play()
|
||||||
|
// If it's not, fall back to the play button
|
||||||
|
player.play();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue