Spaces:
Sleeping
Sleeping
Update public/script.js
Browse files- public/script.js +8 -1
public/script.js
CHANGED
|
@@ -304,7 +304,14 @@ function playVideo() {
|
|
| 304 |
showTitleAfterDelay(tags);
|
| 305 |
addVideoTagsToUi(tags);
|
| 306 |
saveVideoIdToUrl(videoData[CURRENT]);
|
| 307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
}
|
| 309 |
|
| 310 |
function showTitleAfterDelay(tags) {
|
|
|
|
| 304 |
showTitleAfterDelay(tags);
|
| 305 |
addVideoTagsToUi(tags);
|
| 306 |
saveVideoIdToUrl(videoData[CURRENT]);
|
| 307 |
+
|
| 308 |
+
// Handle the play promise to catch interruptions
|
| 309 |
+
const playPromise = videoPlayers[CURRENT].play();
|
| 310 |
+
if (playPromise !== undefined) {
|
| 311 |
+
playPromise.catch(error => {
|
| 312 |
+
console.log("Playback was prevented or interrupted.");
|
| 313 |
+
});
|
| 314 |
+
}
|
| 315 |
}
|
| 316 |
|
| 317 |
function showTitleAfterDelay(tags) {
|