|
@@ -154,6 +154,9 @@ export class VideoSource implements Source
|
154
|
154
|
*/
|
155
|
155
|
_handleAutoPlay(video: HTMLVideoElement): void
|
156
|
156
|
{
|
|
157
|
+ // Autoplay guide: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
|
|
158
|
+ // Chrome policy: https://developer.chrome.com/blog/autoplay/
|
|
159
|
+ // WebKit policy: https://webkit.org/blog/7734/auto-play-policy-changes-for-macos/
|
157
|
160
|
Utils.assert(video.autoplay);
|
158
|
161
|
|
159
|
162
|
// videos marked with autoplay should be muted
|
|
@@ -165,7 +168,7 @@ export class VideoSource implements Source
|
165
|
168
|
const promise = video.play();
|
166
|
169
|
|
167
|
170
|
// handle older browsers
|
168
|
|
- if(typeof promise !== 'object')
|
|
171
|
+ if(promise === undefined)
|
169
|
172
|
return;
|
170
|
173
|
|
171
|
174
|
// can't play the video
|
|
@@ -189,6 +192,12 @@ export class VideoSource implements Source
|
189
|
192
|
document.body.addEventListener('pointerdown', () => video.play());
|
190
|
193
|
alert('Tap on the screen to start');
|
191
|
194
|
}
|
|
195
|
+ /*else {
|
|
196
|
+ // play the video after the first interaction with the page
|
|
197
|
+ const polling = setInterval(() => {
|
|
198
|
+ video.play().then(() => clearInterval(polling));
|
|
199
|
+ }, 500);
|
|
200
|
+ }*/
|
192
|
201
|
}
|
193
|
202
|
|
194
|
203
|
// unsupported media source
|