Skip to content

Commit d8e4ce5

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 d8e4ce5

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cassettator.js",
3-
"version": "0.504.0",
3+
"version": "0.504.1",
44
"description": "A collection of video.js components and plugins",
55
"author": "amtins <[email protected]>",
66
"license": "MIT",

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)