doublesymmetry / react-native-track-player

A fully fledged audio module created for music apps. Provides audio playback, external media controls, background mode and more!
https://rntp.dev/
Apache License 2.0
3.23k stars 997 forks source link

Deeplink doesn't work #1724

Closed AlirezaHadjar closed 1 year ago

AlirezaHadjar commented 1 year ago

Describe the Bug Added deeplink configuration but it doesn't work

Steps To Reproduce When I call Linking.getInitialURL() or Linking.addEventListener, I receive null as response.

Code To Reproduce const url = await Linking.getInitialURL(); console.log(url); Linking.addEventListener("url", (url) => console.log(url);

Environment Info: System: OS: macOS 12.6 CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz Memory: 45.40 MB / 8.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.14.0 - /usr/local/bin/node Yarn: 1.22.19 - ~/.yarn/bin/yarn npm: 8.3.1 - /usr/local/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Android NDK: 22.1.7171670 IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8815526 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 11.0.12 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: ^0.68.2 => 0.68.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found react-native-track-player: v3.1.0 Real device? Or simulator? Android Real device. What OS are you running? macos

puckey commented 1 year ago

How is this related to RNTP?

AlirezaHadjar commented 1 year ago

Ohh. I thought it is related to RNTP because it happens when I click on a music notification. (a track which played from RNTP)

puckey commented 1 year ago

Please fork the repository and rework the example app so it demonstrates the issue you are having.

AlirezaHadjar commented 1 year ago

I ran the example app and added linking configs like below: useEffect(() => { async function run() { const isSetup = await SetupService(); setIsPlayerReady(isSetup); const queue = await TrackPlayer.getQueue(); if (isSetup && queue.length <= 0) { await QueueInitalTracksService(); } // Added the code below Linking.addListener('url', (event) => console.log('event', event)); const url = await Linking.getInitialURL(); console.log('url', url); } run(); }, []);

but the same thing happens. when I open the app from music notification I see LOG url null on the console. Are there any extra steps should I follow to make it work?

Thank you in advance.

puckey commented 1 year ago

Please fork the repository and rework the example app so it demonstrates the issue you are having.

jspizziri commented 1 year ago

@AlirezaHadjar this issue is a duplicate of https://github.com/doublesymmetry/react-native-track-player/issues/1384 , as I mentioned on that issue, and as @puckey has mentioned. I don't think deep-linking has anything to do with our library, but your app.

Our library doesn't ship with any UI, you build that on your side. As such, all deeplinking will need to be handled on your side as well. If there's data that we need to send to AVPlayer somehow so that you can properly deeplink in the UI I might be wrong. But I'd appreciate you finding documentation on how AVPlayer is responsible for this before we go any further. If you can find that, I'll re-open the issue.