Skip to content

Commit

Permalink
Merge pull request #1376 from Arnei/fix-audio-not-playing
Browse files Browse the repository at this point in the history
Fix editor not playing audio due to video order
  • Loading branch information
Arnei authored Aug 16, 2024
2 parents 51aeec0 + 605c375 commit 2cd2bad
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/VideoPlayers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
setJumpTriggered,
selectJumpTriggered,
setCurrentlyAt,
selectVideos,
} from "../redux/videoSlice";

import ReactPlayer, { Config } from "react-player";
Expand Down Expand Up @@ -50,7 +51,9 @@ const VideoPlayers: React.FC<{
maxHeightInPixel = 300,
}) => {

const videoURLs = useAppSelector(selectVideoURL);
const videos = useAppSelector(selectVideos);
let primaryIndex = videos.findIndex(e => e.audio_stream.available === true);
primaryIndex = primaryIndex < 0 ? 0 : primaryIndex;
const videoCount = useAppSelector(selectVideoCount);

const videoPlayerAreaStyle = css({
Expand All @@ -71,8 +74,8 @@ const VideoPlayers: React.FC<{
<VideoPlayer
key={i}
dataKey={i}
url={videoURLs[i]}
isPrimary={i === 0}
url={videos[i].uri}
isPrimary={i === primaryIndex}
subtitleUrl={""}
first={i === 0}
last={i === videoCount - 1}
Expand Down

0 comments on commit 2cd2bad

Please sign in to comment.