Add MediaService API for volume control and playback management#798
Add MediaService API for volume control and playback management#798jLynx wants to merge 1 commit intocoredevices:mainfrom
Conversation
Signed-off-by: Joel Herbert <[email protected]>
|
I think find-my-phone should/will eventually be a native feature in PebbleOS/MobileApp. Should work easily on Android, and on iOS we can request special permissions to play audio in the background. Would you be interested in working on this feature for PebbleOS/mobile app? |
|
Hi @ericmigi yes I would be interested in working on this. Also if you havent seen already, there is a fair bit of discussion for this PR happening in Discord from here down https://discord.com/channels/221364737269694464/256091649996881922/1469892194201506023 Current throught are that this would still be a good addition regardless as it opens up the app developer ecosystem a bit further to allow things such as music info on watchface or for instance lyric lookup in apps for the current playing songs. So regardless on if we also create a a native built-in find my phone app, I think this would be a great addition. But again coming back to your original comment, yes I would still love to work on a native implementation of a find my phone app (as that would solve the issue with it not working on iOS with the webkit limitations) |
|
@ericmigi yes I have built a POC with my current find my phone app that uses this. But I can create public test app that uses all the functions if you would like? |
|
Sorry for the confusion - if you'd like to build a 'find my phone' feature, that would be very welcome! Please build it into PebbleOS as an 'native app' and build the corresponding feature into https://github.com/coredevices/mobileapp. This media api is interesting. We're working on a 'complications api' (https://ericmigi.com/blog/how-to-build-a-smartwatch-software-setting-expectations-and-roadmap/#pebble-sdk-and-devel) that would be a better fit for it though. More news on that in a few months |
This PR exposes the MediaService API to app developers, enabling them to access and control media playback information and volume on connected devices.
Motivation
I'm creating this PR to support enhanced functionality in the Find My Phone app. Currently, when you use the app to locate your phone, there's no way to ensure the device is at an audible volume. By exposing the MediaService API, the app will be able to raise the volume of the device when making it ring, making it much easier to actually find your phone!
More broadly, this opens up a lot of possibilities for app developers to create richer media experiences on Pebble watches.
Changes
SDK Version
New APIs Exposed
MediaService
Provides comprehensive media playback control and information:
Playback Information:
music_get_now_playing()- Get current track title, artist, and albummusic_has_now_playing()- Check if media is currently availablemusic_get_player_name()- Get the name of the active media playermusic_get_pos()- Get current track position and lengthmusic_get_ms_since_pos_last_updated()- Get time since position was last updatedmusic_get_playback_rate_percent()- Get playback speedmusic_get_playback_state()- Get current playback state (playing, paused, etc.)Volume Control:
music_get_volume_percent()- Get current volume levelmusic_is_volume_reporting_supported()- Check if volume reporting is availableCapability Detection:
music_is_playback_state_reporting_supported()music_is_progress_reporting_supported()music_is_command_supported()- Check if specific commands are supportedPlayback Control:
music_command_send()- Send media commands (play, pause, volume up/down, etc.)music_needs_user_to_start_playback_on_phone()- Check if user interaction is neededPerformance:
music_request_reduced_latency()- Request lower latency updatesmusic_request_low_latency_for_period()- Request low latency for a specific durationDebugging:
music_get_connected_server_debug_name()- Get debug information about connected serverEventServiceClient
Added event subscription system for apps to receive media events:
event_service_client_subscribe()- Subscribe to eventsevent_service_client_unsubscribe()- Unsubscribe from eventsPebbleEvent,PebbleEventType,EventServiceEventHandler,EventServiceInfoImplementation Details
music_syscalls.cwith proper privilege checking and buffer validationexported_symbols.jsonfor SDK generationUse Cases
This API enables apps like: