Spaces:
Running
Running
Add play button for devices with autoplay restrictions
#1
by
matthoffner
- opened
- public/index.html +8 -0
public/index.html
CHANGED
@@ -45,6 +45,14 @@
|
|
45 |
}, 1200)
|
46 |
}, false);
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
player.play()
|
49 |
}
|
50 |
})()
|
|
|
45 |
}, 1200)
|
46 |
}, false);
|
47 |
|
48 |
+
// Handle autoplay restrictions.
|
49 |
+
var promise = videoElement.play();
|
50 |
+
if (promise !== undefined) {
|
51 |
+
videoElement.addEventListener('click', function() {
|
52 |
+
videoElement.play();
|
53 |
+
});
|
54 |
+
}
|
55 |
+
|
56 |
player.play()
|
57 |
}
|
58 |
})()
|