It would be good if the Discord rich presence resembles Spotify's rich presence. Not an exact copy, but there should be an option to showcase music playback from the user's profile.
Suggested solution
This might help you.
import 'dart:async';
import 'package:discord_rpc/discord_rpc.dart' as discord_rpc;
void main() {
discord_rpc.initialize('YOUR_CLIENT_ID');
// Define a custom URI that your application can handle
final playButtonUri = 'yourmusicapp://play';
discord_rpc.updatePresence(
discord_rpc.Presence(
details: 'Listening to Music',
state: 'Song Title',
largeImageKey: 'spotify',
largeImageText: 'Your Software Name',
buttons: [
discord_rpc.Button(label: 'Play', url: playButtonUri),
],
),
);
// Optional: Set up a periodic timer to keep the presence updated
Timer.periodic(Duration(seconds: 15), (timer) {
discord_rpc.updatePresence(
discord_rpc.Presence(
details: 'Listening to Music',
state: 'Song Title',
largeImageKey: 'spotify',
largeImageText: 'Your Software Name',
buttons: [
discord_rpc.Button(label: 'Play', url: playButtonUri),
],
),
);
});
// Ensure to close the connection when your application exits
// This is a simple console app example; in a real application, handle this properly
// For web applications, use window.onUnload or similar
ProcessSignal.sigint.watch().listen((_) {
discord_rpc.shutdown();
exit(0);
});
}
Custom Link: The "Play" button in Discord sends a special link (e.g., yourmusicapp://play).
Your Software Setup: Your music software must be set up to recognize and respond when it receives this special link.
User Clicks "Play": Clicking "Play" on Discord opens the link.
Desired Action: Your music software, if properly configured, performs the desired action, like playing a specific song associated with the link.
Is there an existing issue for this?
It would be good if the Discord rich presence resembles Spotify's rich presence. Not an exact copy, but there should be an option to showcase music playback from the user's profile.
Suggested solution
This might help you.
Custom Link: The "Play" button in Discord sends a special link (e.g., yourmusicapp://play).
Your Software Setup: Your music software must be set up to recognize and respond when it receives this special link.
User Clicks "Play": Clicking "Play" on Discord opens the link.
Desired Action: Your music software, if properly configured, performs the desired action, like playing a specific song associated with the link.
Useful resources
No response
Additional information
No response