fix(dashboard): guard the synced-playback seek against a non-finite time
Found while browser-testing the editor: a clip without a start yet makes ResultCard emit onPlay(NaN), and assigning that to currentTime throws in a mount effect, taking the whole tree down to a black screen.
This commit is contained in:
parent
0b59047422
commit
4a71d66066
1 changed files with 3 additions and 2 deletions
|
|
@ -31,8 +31,9 @@ const ProcessingAnimation = ({ media, isComplete, syncedTime, isSyncedPlaying, s
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isYouTube && videoRef.current) {
|
if (!isYouTube && videoRef.current) {
|
||||||
if (isSyncedPlaying) {
|
if (isSyncedPlaying) {
|
||||||
// Sync Mode: Seek to time and Play
|
// Sync Mode: Seek to time and Play. A non-finite time (a clip with no
|
||||||
videoRef.current.currentTime = syncedTime;
|
// start yet) would throw and take the whole tree down — skip the seek.
|
||||||
|
if (Number.isFinite(syncedTime)) videoRef.current.currentTime = syncedTime;
|
||||||
videoRef.current.play().catch(e => console.log("Auto-play prevented", e));
|
videoRef.current.play().catch(e => console.log("Auto-play prevented", e));
|
||||||
videoRef.current.loop = false;
|
videoRef.current.loop = false;
|
||||||
videoRef.current.muted = true; // Keep muted to avoid double audio with clip
|
videoRef.current.muted = true; // Keep muted to avoid double audio with clip
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue