Skip to content

Commit 122951d

Browse files
committed
fix(marker-display): error when changing resource
Fix #12 which occurred when loading resource after starting playback. This bug didn't cause any component malfunctions, apart from displaying errors in the console. - adds a guard clause to `updateMarker` to update the marker only if `getClientRects` is not empty
1 parent da6f701 commit 122951d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/markers/src/marker-display.js

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ class MarkerDisplay extends videojs.getComponent('component') {
6868
* @param {string} cssVar - The CSS variable name.
6969
*/
7070
updateMarker(time = 0, cssVar) {
71+
if(!this.parentComponent_.el().getClientRects().length) return;
72+
7173
const duration = this.player().duration();
7274
const markersElWidth = this.parentComponent_.el().getClientRects()[0].width;
7375
const markerOffsetLeft = this.el().offsetLeft;

0 commit comments

Comments
 (0)