Add optional chaining for sponsor segments.

This commit is contained in:
Kavin 2022-06-06 03:41:13 +01:00
parent 43fa5d8db8
commit 6371973943
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD

View File

@ -559,7 +559,7 @@ export default {
updateMarkers() {
const markers = this.$refs.container.querySelector(".shaka-ad-markers");
const array = ["to right"];
this.sponsors?.segments.forEach(segment => {
this.sponsors?.segments?.forEach(segment => {
const start = (segment.segment[0] / this.video.duration) * 100;
const end = (segment.segment[1] / this.video.duration) * 100;