fix: show loader for videos but not music

This commit is contained in:
Fredrik Burmester
2024-08-13 14:41:37 +02:00
parent 9628285701
commit 75de878618

View File

@@ -56,6 +56,7 @@ export const CurrentlyPlayingBar: React.FC = () => {
const videoRef = useRef<VideoRef | null>(null); const videoRef = useRef<VideoRef | null>(null);
const [paused, setPaused] = useState(true); const [paused, setPaused] = useState(true);
const [progress, setProgress] = useState(0); const [progress, setProgress] = useState(0);
const [pip, setPip] = useState(false);
const aBottom = useSharedValue(0); const aBottom = useSharedValue(0);
const aPadding = useSharedValue(0); const aPadding = useSharedValue(0);
@@ -229,14 +230,19 @@ export const CurrentlyPlayingBar: React.FC = () => {
{cp.playbackUrl && ( {cp.playbackUrl && (
<Video <Video
ref={videoRef} ref={videoRef}
allowsExternalPlayback
style={{ width: "100%", height: "100%" }} style={{ width: "100%", height: "100%" }}
allowsExternalPlayback={true}
playInBackground={true}
playWhenInactive={true} playWhenInactive={true}
playInBackground={!pip}
pictureInPicture={pip}
showNotificationControls={true} showNotificationControls={true}
ignoreSilentSwitch="ignore" ignoreSilentSwitch="ignore"
controls={false} controls={false}
poster={backdropUrl ? backdropUrl : undefined} poster={
backdropUrl && item?.Type === "Audio"
? backdropUrl
: undefined
}
paused={paused} paused={paused}
onProgress={(e) => onProgress(e)} onProgress={(e) => onProgress(e)}
subtitleStyle={{ subtitleStyle={{
@@ -261,15 +267,12 @@ export const CurrentlyPlayingBar: React.FC = () => {
); );
}} }}
renderLoader={ renderLoader={
item?.Type === "Video" && ( item?.Type !== "Audio" && (
<View className="flex flex-col items-center justify-center h-full"> <View className="flex flex-col items-center justify-center h-full">
<ActivityIndicator size={"small"} color={"white"} /> <ActivityIndicator size={"small"} color={"white"} />
</View> </View>
) )
} }
subtitleStyle={{
fontSize: 20,
}}
/> />
)} )}
</TouchableOpacity> </TouchableOpacity>