Skip to content

Conversation

@jLynx
Copy link

@jLynx jLynx commented Feb 8, 2026

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

  • Bumped SDK version from 0x56 to 0x57 (revision 90)

New APIs Exposed

MediaService

Provides comprehensive media playback control and information:

Playback Information:

  • music_get_now_playing() - Get current track title, artist, and album
  • music_has_now_playing() - Check if media is currently available
  • music_get_player_name() - Get the name of the active media player
  • music_get_pos() - Get current track position and length
  • music_get_ms_since_pos_last_updated() - Get time since position was last updated
  • music_get_playback_rate_percent() - Get playback speed
  • music_get_playback_state() - Get current playback state (playing, paused, etc.)

Volume Control:

  • music_get_volume_percent() - Get current volume level
  • music_is_volume_reporting_supported() - Check if volume reporting is available

Capability Detection:

  • music_is_playback_state_reporting_supported()
  • music_is_progress_reporting_supported()
  • music_is_command_supported() - Check if specific commands are supported

Playback 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 needed

Performance:

  • music_request_reduced_latency() - Request lower latency updates
  • music_request_low_latency_for_period() - Request low latency for a specific duration

Debugging:

  • music_get_connected_server_debug_name() - Get debug information about connected server

EventServiceClient

Added event subscription system for apps to receive media events:

  • event_service_client_subscribe() - Subscribe to events
  • event_service_client_unsubscribe() - Unsubscribe from events
  • New types: PebbleEvent, PebbleEventType, EventServiceEventHandler, EventServiceInfo

Implementation Details

  • Added syscall wrappers in music_syscalls.c with proper privilege checking and buffer validation
  • All pointer parameters are validated when privilege is elevated to prevent security issues
  • Exported all new functions and types in exported_symbols.json for SDK generation

Use Cases

This API enables apps like:

  • Find My Phone - Can now increase device volume when making it ring for easier location
  • Custom media controllers - Full-featured music control apps with volume management
  • Now playing displays - Show current track information with accurate progress

@jLynx jLynx marked this pull request as ready for review February 8, 2026 03:02
@ericmigi
Copy link
Collaborator

ericmigi commented Feb 8, 2026

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?

@jLynx
Copy link
Author

jLynx commented Feb 8, 2026

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
Copy link
Collaborator

ericmigi commented Feb 9, 2026

ah got it, yeah that seems useful but let's separate that out from find-my-phone.

For this PR, have you built a test app that consumes this info and tests the API? Are you pretty sure this is the right API structure for this?

adding @sjp4 and @HBehrens who would be interested

@jLynx
Copy link
Author

jLynx commented Feb 10, 2026

@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?
And yes this should be the correct API structure. As for the changes we are basically exposing the existing API that the built in music app uses

@ericmigi
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants