(FIX) Display the correct menu title for play/pause #178
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The dock and playback menu item was always displaying "Play" as the first option regardless of the current state of the playback.
Fixes #112
Proposed solution
Looks like the dock menu used to display the correct title at some point but then got broken due to the change on YouTube's side.
After reviewing the code, I've realised that the current "isPlaying" value is read from the webpage once a second by comparing the play button title to the string constant. It looks like the constant name was changed from
![Screenshot 2022-11-27 at 07 13 56](https://user-images.githubusercontent.com/4711044/204124244-1db0487b-1f88-4e70-8df1-50a5302d3fcc.png)
YT_PAUSE
toPAUSE
breaking the implementation.I fixed the implementation by updating the name of the constant in the custom script.
The main menu item on the other hand was always displaying the "Play" option regardless of the current playback. I've used the same logic to update the menu item as well.
Evidence of testing
Tested by running the app on my machine.