react-native-track-player icon indicating copy to clipboard operation
react-native-track-player copied to clipboard

[iOS] s3 wav audio url is not playing on iOS Simulator

Open janandaraj opened this issue 1 year ago • 2 comments

Describe the Bug I'm trying to play s3 pre-signed url it's working fine on android but not playing on iOS throwing some errors

 LOG  Playback State {"error": {"code": "ios_failed_to_load_resource", "message": "Failed to load resource"}, "state": "error"}
 LOG  {"error": "The operation couldn’t be completed. (SwiftAudioEx.AudioPlayerError.PlaybackError error 1.)"}

Steps To Reproduce

Just use any below s3 url in the url section and press play(this url is temporary will be expired)

https://treblearth.s3.us-east-1.amazonaws.com/output_1724225965651.wav?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=ASIAR5NEKHRDMVJEPZVI/20240821/us-east-1/s3/aws4_request&X-Amz-Date=20240821T073926Z&X-Amz-Expires=3600&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEGgaCXVzLWVhc3QtMSJIMEYCIQDhVGwd2Nrj06dpG7DE+aJiCWtirzRKokZ4a/qUjUCg7wIhALBPFrzrH5OqPl2rLGrLocJf8tugVvqQCBU/rLZViUGyKuoCCHEQAhoMMTMxODc3OTc3MTU4IgwJ0FZqtF6t6ThQavkqxwKdhb73BVVdnkxtnp5UsAc5u4EryHlkCg4XdK1hRy027pmAh3buhw/+HKd6SBhUW3i+ET+N/nS9sX02xxc7VyJe4fQcccqxLYgXBZVKRq4BZZv7dQppeZoA06xzF8xQzbUBr+3DuplrB5Gt90XqqclRTZs7SFqq1hZgAZxiW1Lbs6/G4xkbDHmbzDTqv3HaRitLMLJvZYlIH736VTPigxu2EDDftjRn/wc3+fHhXLNUqfyvlR0hV6CND1FR3rt/AtwyTH5gbKEFQAWKqaYRJpBRYab7915bEr4NJQAWTVqjSug+0KBazFwkJ9/Nx7Potv2lcQtz2zZbDexyfKeGprcfO129EJMFznfHhzgY6H6xYOu0s7W9fSBIvNbOzlx2e4VDdceZLKEWNuMvS67QhCmzSkiOHt9ha1dyZa3lP7Rr8m+Nbe0q4QgwrrGWtgY6nQGR/rmFuN7ZXILdIq2OCbKfh3a0Y0cnC9AdVUTrICN+vnUPOpP6BzRyEJdzjV0XKktLZ9kdhLpScsMrps+7F4CE2zDPa1wkAYNUqFm7unlL4aC3gHw36r//U2kOVsSuRM/5fRAfHMeND772YGYpRWNUFnZ+t/NPXgn0ro7vX7M9q33V1y4/D0i4eTyju/AcvMkpVmBIxK3u7eVMx7jz&X-Amz-Signature=06a5d16ecd8c24c78b3e397cc1a9f40cfe1ee81e042e0afca6464a0ea3947256&X-Amz-SignedHeaders=host&response-content-type=audio/wav&x-id=GetObject

Note: I have tried decodingURI component still no luck

Code To Reproduce

var url = above s3 urls;

await TrackPlayer.add({ id: 'trackId', url: url, title: 'Track Title', artist: 'Track Artist', artwork: require('./app/track.png'), album: 'while(1<2)', genre: 'Progressive House, Electro House', date: '2014-05-20T07:00:00+00:00', // RFC 3339 type: TrackType.Default, });

//onButton click await TrackPlayer.play()

Environment Info:

System: OS: macOS 14.5 CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz Memory: 69.14 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.13.1 path: /usr/local/bin/node Yarn: version: 3.6.4 path: /usr/local/bin/yarn npm: version: 10.5.2 path: /usr/local/bin/npm Watchman: version: 2024.06.24.00 path: /usr/local/bin/watchman Managers: CocoaPods: version: 1.15.2 path: /usr/local/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.5 - iOS 17.5 - macOS 14.5 - tvOS 17.5 - visionOS 1.2 - watchOS 10.5 Android SDK: Not Found IDEs: Android Studio: 2023.3 AI-233.14808.21.2331.11842104 Xcode: version: 15.4/15F31d path: /usr/bin/xcodebuild Languages: Java: version: 17.0.11 path: /usr/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.3.1 wanted: 18.3.1 react-native: installed: 0.75.1 wanted: 0.75.1 react-native-macos: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false

"react-native-track-player": "^4.1.1"

Real device? Or simulator? Simulator - iOS Android works fine

What OS are you running? No

How I can Help Give a fix to resolve that issue even a temp patch works

janandaraj avatar Aug 21 '24 08:08 janandaraj

replace fileNameUrl = [NSURL URLWithString:fileNameEscaped]; with fileNameUrl = [NSURL URLWithString:fileName];

I have also tried other packages, like react-native-sound, but it has the same issue. However, I found a solution that seems to fix it: Stack Overflow link. Please check if this applies here as well.

janandaraj avatar Aug 21 '24 08:08 janandaraj

shouldnt YOU try the solution first by identifying if your link has special charcgers? and stop posting links with expiration tokens they don't work for anyone else

lovegaoshi avatar Aug 21 '24 12:08 lovegaoshi

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Nov 20 '24 02:11 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Nov 27 '24 02:11 github-actions[bot]