(player: Player)
| 44 | const thumbnailPreviewRef = useRef<HTMLDivElement>(null); |
| 45 | |
| 46 | const overrideUpdateTime = (player: Player) => { |
| 47 | const seekBar = player |
| 48 | .getChild('ControlBar') |
| 49 | ?.getChild('ProgressControl') |
| 50 | ?.getChild('SeekBar'); |
| 51 | |
| 52 | if (seekBar) { |
| 53 | const mouseTimeDisplay = seekBar.getChild('mouseTimeDisplay'); |
| 54 | if (mouseTimeDisplay) { |
| 55 | const timeTooltip: any = mouseTimeDisplay.getChild('timeTooltip'); |
| 56 | if (timeTooltip) { |
| 57 | timeTooltip.update = function( |
| 58 | seekBarRect: any, |
| 59 | seekBarPoint: any, |
| 60 | time: string, |
| 61 | ) { |
| 62 | const segmentName = getCurrentSegmentName(time, segments); |
| 63 | this.write(`${time} - ${segmentName}`); |
| 64 | |
| 65 | // Delay the execution to ensure the tooltip width is calculated after the content update |
| 66 | setTimeout(() => { |
| 67 | const tooltipWidth = this.el().offsetWidth; |
| 68 | // Calculate the offset from the right side |
| 69 | const rightOffset = tooltipWidth / 2; |
| 70 | this.el().style.right = `-${rightOffset}px`; |
| 71 | |
| 72 | // Adjust the left style to 'auto' to avoid conflict with the right property |
| 73 | this.el().style.left = 'auto'; |
| 74 | this.el().style.width = '200px'; |
| 75 | this.el().style.fontSize = '14px'; |
| 76 | }, 0); |
| 77 | }; |
| 78 | } else { |
| 79 | console.error('TimeTooltip component not found.'); |
| 80 | } |
| 81 | } else { |
| 82 | console.error('MouseTimeDisplay component not found.'); |
| 83 | } |
| 84 | } else { |
| 85 | console.error('SeekBar component not found.'); |
| 86 | } |
| 87 | }; |
| 88 | const handlePlayerReady = async (player: Player) => { |
| 89 | playerRef.current = player; |
| 90 |
no test coverage detected