Sinono3 / souvlaki

A cross-platform library for handling OS media controls and metadata.
MIT License
79 stars 15 forks source link

Control capabilities #12

Open Sinono3 opened 3 years ago

Sinono3 commented 3 years ago

Right now the MediaControls struct assumes all the events can be handled. This should be under the control of the user, and dynamically, over the course of the program. I think the solution would be to create a struct like this:

// Capability? Ability? 
// I can't think of something else
// It needs a shorter name that's still intuitive.
enum MediaControlCapability {
    Play,
    Pause,
    Toggle,
    Seek,
    // etc...
}

This enum would be used to control the capabilities of the controls, like controls.set_enabled(MediaControlCapability::Play, true);. The implementation would probably vary in each platform.

If a capability is disabled, should we, still delegate it to the user handler? We probably shouldn't since in moost cases behaviour the specs say it should be ignored. Besides, it would be annoying having to check capabilities in the handler again.

Another feature I would like to implement with this issue is allowing players without controls, such as a player only showing metadata, handling no events.