andrewmcgivery / obsidian-soundscapes

A plugin for Obsidian.MD that adds a music/ambiance player to the status bar to play Lofi beats, nature sounds, ambiance, relaxing music, and more.
MIT License
46 stars 7 forks source link

Add playback commands #36

Open ch33kaboo opened 3 months ago

ch33kaboo commented 3 months ago

This is the implementation of the feature request #35 (I opened few hours earlier). Adding commands to the plugin is useful because the user can control their playback without touching the mouse, they can use the command palette or assign hotkeys (keyboard shortcuts) to the commands. Here is a breakdown of the changes:

I tested the changes and they all work fine image

ch33kaboo commented 2 months ago

hello @andrewmcgivery , I didn't know there was a simple way to know if the track is playing or not and that's why I introduced a new variable. Anyway, I fixed the code by using if(this.localPlayerStateObservable.getValue().playerState === PLAYER_STATE.PLAYING) as you mentioned, I tested it and it works all fine. 👍👍