diff --git a/frontend-tools/video-js/src/components/markers/ChapterMarkers.js b/frontend-tools/video-js/src/components/markers/ChapterMarkers.js index 785a13dd..2f4691d6 100644 --- a/frontend-tools/video-js/src/components/markers/ChapterMarkers.js +++ b/frontend-tools/video-js/src/components/markers/ChapterMarkers.js @@ -86,7 +86,16 @@ class ChapterMarkers extends Component { return; } - const progressControl = this.player().getChild('controlBar').getChild('progressControl'); + // Try to get progress control from control bar first, then from moved location + let progressControl = this.player().getChild('controlBar').getChild('progressControl'); + + // If not found in control bar, it might have been moved to a wrapper + if (!progressControl) { + // Look for moved progress control in custom components + const customComponents = this.player().customComponents || {}; + progressControl = customComponents.movedProgressControl; + } + if (!progressControl) return; const seekBar = progressControl.getChild('seekBar'); @@ -375,7 +384,14 @@ class ChapterMarkers extends Component { dispose() { // Clean up event listeners - const progressControl = this.player().getChild('controlBar')?.getChild('progressControl'); + let progressControl = this.player().getChild('controlBar')?.getChild('progressControl'); + + // If not found in control bar, it might have been moved to a wrapper + if (!progressControl) { + const customComponents = this.player().customComponents || {}; + progressControl = customComponents.movedProgressControl; + } + if (progressControl) { const progressControlEl = progressControl.el(); progressControlEl.removeEventListener('mouseenter', this.handleMouseEnter); diff --git a/frontend-tools/video-js/src/components/markers/SpritePreview.js b/frontend-tools/video-js/src/components/markers/SpritePreview.js index 65ec8d60..66a7f80c 100644 --- a/frontend-tools/video-js/src/components/markers/SpritePreview.js +++ b/frontend-tools/video-js/src/components/markers/SpritePreview.js @@ -36,8 +36,22 @@ class SpritePreview extends Component { return; } - const progressControl = this.player().getChild('controlBar').getChild('progressControl'); - if (!progressControl) return; + // Try to get progress control from control bar first, then from moved location + let progressControl = this.player().getChild('controlBar').getChild('progressControl'); + console.log('SpritePreview: progressControl from controlBar:', progressControl); + + // If not found in control bar, it might have been moved to a wrapper + if (!progressControl) { + // Look for moved progress control in custom components + const customComponents = this.player().customComponents || {}; + progressControl = customComponents.movedProgressControl; + console.log('SpritePreview: progressControl from customComponents:', progressControl); + } + + if (!progressControl) { + console.log('SpritePreview: No progress control found!'); + return; + } const seekBar = progressControl.getChild('seekBar'); if (!seekBar) return; @@ -229,7 +243,14 @@ class SpritePreview extends Component { dispose() { // Clean up event listeners - const progressControl = this.player().getChild('controlBar')?.getChild('progressControl'); + let progressControl = this.player().getChild('controlBar')?.getChild('progressControl'); + + // If not found in control bar, it might have been moved to a wrapper + if (!progressControl) { + const customComponents = this.player().customComponents || {}; + progressControl = customComponents.movedProgressControl; + } + if (progressControl) { const progressControlEl = progressControl.el(); progressControlEl.removeEventListener('mouseenter', this.handleMouseEnter); diff --git a/frontend-tools/video-js/src/components/video-player/VideoJSPlayer.jsx b/frontend-tools/video-js/src/components/video-player/VideoJSPlayer.jsx index 9399a30d..dbd3ede6 100644 --- a/frontend-tools/video-js/src/components/video-player/VideoJSPlayer.jsx +++ b/frontend-tools/video-js/src/components/video-player/VideoJSPlayer.jsx @@ -2603,6 +2603,9 @@ function VideoJSPlayer({ videoId = 'default-video' }) { customComponents.current.movedProgressControl = progressControl; customComponents.current.controlsWrapper = wrapper; + // Also store on player instance for sprite preview access + playerRef.current.customComponents = customComponents.current; + // Hide/show progress bar with control bar based on user activity const syncProgressVisibility = () => {