You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Bug
I am experiencing an issue where I can successfully play a remote MP3 file using react-native-track-player, but local audio files saved in DocumentDirectoryPath are not playing.
I get the following error when trying to play a local file:
error: {message: 'The track could not be played', code: 'ios_track_unplayable'}
However, a remote URL works fine:
Steps To Reproduce
1-Copy an MP3 file from local storage to the app's document directory:
const simplePath = ${DocumentDirectoryPath}/audio.mp3;
await copyFile(tracker, simplePath);
=> the track is a document picked by the user inside the application
2-Try to play the copied file:
await TrackPlayer.add({
id: track_${Date.now()},
url: file://${simplePath},
title: 'Local Track',
artist: 'Unknown',
});
await TrackPlayer.play();
Describe the Bug
I am experiencing an issue where I can successfully play a remote MP3 file using react-native-track-player, but local audio files saved in DocumentDirectoryPath are not playing.
I get the following error when trying to play a local file:
error: {message: 'The track could not be played', code: 'ios_track_unplayable'}
However, a remote URL works fine:
await TrackPlayer.add({
id: 'test-url',
url: 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3',
title: 'Test Audio',
artist: 'Unknown',
});
await TrackPlayer.play();
Steps To Reproduce
1-Copy an MP3 file from local storage to the app's document directory:
const simplePath =
${DocumentDirectoryPath}/audio.mp3
;await copyFile(tracker, simplePath);
=> the track is a document picked by the user inside the application
2-Try to play the copied file:
await TrackPlayer.add({
id:
track_${Date.now()}
,url:
file://${simplePath}
,title: 'Local Track',
artist: 'Unknown',
});
await TrackPlayer.play();
3-It throws the error: ios_track_unplayable.
Code To Reproduce
const setupPlayer = async () => {
try {
const simplePath =
${DocumentDirectoryPath}/audio.mp3
;};
Environment Info:
System:
OS: macOS 13.5.2
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 91.71 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.11.0
path: /usr/local/bin/node
Yarn:
version: 1.22.10
path: /usr/local/bin/yarn
npm:
version: 10.9.2
path: ~/Desktop/projects/audittab/node_modules/.bin/npm
Watchman:
version: 2023.01.16.00
path: /usr/local/bin/watchman
Managers:
CocoaPods:
version: 1.13.0
path: /Users/macbookpro/.rvm/gems/ruby-2.7.1/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.2
- iOS 17.2
- macOS 14.2
- tvOS 17.2
- watchOS 10.2
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.6
wanted: 0.72.6
iOS:
hermesEnabled: false
newArchEnabled: false
"react-native-track-player": "^4.1.1",
Real device
IOS 17.6.1
The text was updated successfully, but these errors were encountered: