alert after paroles
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { useAudioPlayer, useAudioPlayerStatus } from "expo-audio";
|
||||
import React, {
|
||||
createContext,
|
||||
useCallback,
|
||||
@@ -7,7 +8,6 @@ import React, {
|
||||
useState,
|
||||
} from "react";
|
||||
import { Platform } from "react-native";
|
||||
import { useAudioPlayer, useAudioPlayerStatus } from "expo-audio";
|
||||
import { useGlobal } from "reactn";
|
||||
|
||||
import GlobalAudioPlayer from "../components/player/GlobalAudioPlayer";
|
||||
@@ -153,7 +153,12 @@ const normalizeTrack = (trackInput = {}, options = {}) => {
|
||||
if (!id && typeof source === "number") {
|
||||
id = String(source);
|
||||
}
|
||||
if (!id && source && typeof source === "object" && typeof source.uri === "string") {
|
||||
if (
|
||||
!id &&
|
||||
source &&
|
||||
typeof source === "object" &&
|
||||
typeof source.uri === "string"
|
||||
) {
|
||||
id = source.uri;
|
||||
}
|
||||
if (!id) {
|
||||
@@ -174,7 +179,12 @@ const normalizeTrack = (trackInput = {}, options = {}) => {
|
||||
? options.artist
|
||||
: "";
|
||||
|
||||
const artwork = track?.artwork ?? track?.coverUrl ?? options?.artwork ?? options?.coverUrl ?? null;
|
||||
const artwork =
|
||||
track?.artwork ??
|
||||
track?.coverUrl ??
|
||||
options?.artwork ??
|
||||
options?.coverUrl ??
|
||||
null;
|
||||
|
||||
return {
|
||||
id,
|
||||
@@ -282,7 +292,9 @@ const PlayerProvider = ({ children }) => {
|
||||
async (trackInput, options = {}) => {
|
||||
const normalized = normalizeTrack(trackInput, options);
|
||||
if (!normalized.source) {
|
||||
console.warn("PlayerProvider: impossible de lancer la lecture, source audio manquante");
|
||||
console.warn(
|
||||
"PlayerProvider: impossible de lancer la lecture, source audio manquante"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -370,7 +382,10 @@ const PlayerProvider = ({ children }) => {
|
||||
options
|
||||
);
|
||||
|
||||
if (trackInput && (!currentTrack || (targetId && targetId !== currentTrack.id))) {
|
||||
if (
|
||||
trackInput &&
|
||||
(!currentTrack || (targetId && targetId !== currentTrack.id))
|
||||
) {
|
||||
await play(trackInput, options);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user