8000 Media keys doesn't work · Issue #3574 · iina/iina · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Media keys doesn't work #3574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TheBlinded opened this issue Dec 13, 2021 · 9 comments
Closed

Media keys doesn't work #3574

TheBlinded opened this issue Dec 13, 2021 · 9 comments

Comments

@TheBlinded
Copy link
TheBlinded commented Dec 13, 2021

System and IINA version:

  • macOS 11.6.1
  • IINA 1.1.2 and 1.2

Expected behavior:
Clicking the play / pause button on the keyboard should cause the video to start or stop.

Actual behavior:
With iina open and clicking the play button, the "Music" system app opens. With all the other programs, however, the button works (VLC, videos on Firefox etc.).
In fact, iina is the only one that never appears in the playback menu (attached image). This happens from Catalina I think. I attach screenshots to make it clear.

Steps to reproduce:
Open any audio or video with iina.

How often does this happen?
Always.

MPV 0.34.0 have the same problem.

Schermata 2021-12-13 alle 18 08 34

@low-batt
Copy link
Contributor

Similar report in #3340.

I quickly ran a test. Under Catalina and the play / pause was recognized by IINA. Under Monterey, 12.0.1, I experienced the reported behavior. With IINA playing and in focus the play / pause key started the Music app instead of pausing IINA. Seems like something changed in Big Sur.

@low-batt
Copy link
Contributor

I found a problem. The property playbackState in the MPNowPlayingInfoCenter is left set to unknown when playing starts instead of being updated to playing. That needs to be fixed. Continuing to investigate.

low-batt added a commit to low-batt/iina that referenced this issue Dec 16, 2021
The commit in the pull request:
- Adds the ability to set the state to `NowPlayingInfoManager.updateInfo`
- Eliminates the method  `NowPlayingInfoManager.updateState`
- Changes  `PlayerCore.fileStarted` to set the state to `playing`
- Changes references to `updateState` to use `updateInfo`
@low-batt
Copy link
Contributor

Analysis

In AppDelegate.applicationDidFinishLaunching support for the Now Playing Control Center is initialized, setting the property playbackState in the MPNowPlayingInfoCenter to unknown. Then in PlayerCore.fileStarted the MPNowPlayingInfoCenter is updated with information about the media being played such as the title, but the playbackState is not updated and is left set to unknown. Apparently starting with Big Sur the playbackState must be set to something other than unknown for the Now Playing Control Center to assign the media keys to the application. Likely this is a result of Apple porting Control Center code from iOS to macOS.

Fixing

The commit in the pull request:

  • Adds the ability to set the state to NowPlayingInfoManager.updateInfo
  • Eliminates the method NowPlayingInfoManager.updateState
  • Changes PlayerCore.fileStarted to set the state to playing
  • Changes references to updateState to use updateInfo

low-batt added a commit to CarterLi/iina that referenced this issue Dec 16, 2021
The commit in the pull request:
- Adds the ability to set the state to `NowPlayingInfoManager.updateInfo`
- Eliminates the method  `NowPlayingInfoManager.updateState`
- Changes  `PlayerCore.fileStarted` to set the state to `playing`
- Changes references to `updateState` to use `updateInfo`
CarterLi pushed a commit to CarterLi/iina that referenced this issue Jan 19, 2022
The commit in the pull request:
- Adds the ability to set the state to `NowPlayingInfoManager.updateInfo`
- Eliminates the method  `NowPlayingInfoManager.updateState`
- Changes  `PlayerCore.fileStarted` to set the state to `playing`
- Changes references to `updateState` to use `updateInfo`
CarterLi pushed a commit to CarterLi/iina that referenced this issue Jan 21, 2022
The commit in the pull request:
- Adds the ability to set the state to `NowPlayingInfoManager.updateInfo`
- Eliminates the method  `NowPlayingInfoManager.updateState`
- Changes  `PlayerCore.fileStarted` to set the state to `playing`
- Changes references to `updateState` to use `updateInfo`
low-batt added a commit to CarterLi/iina that referenced this issue Jan 21, 2022
The commit in the pull request:
- Adds the ability to set the state to `NowPlayingInfoManager.updateInfo`
- Eliminates the method  `NowPlayingInfoManager.updateState`
- Changes  `PlayerCore.fileStarted` to set the state to `playing`
- Changes references to `updateState` to use `updateInfo`
CarterLi pushed a commit to CarterLi/iina that referenced this issue Feb 18, 2022
The commit in the pull request:
- Adds the ability to set the state to `NowPlayingInfoManager.updateInfo`
- Eliminates the method  `NowPlayingInfoManager.updateState`
- Changes  `PlayerCore.fileStarted` to set the state to `playing`
- Changes references to `updateState` to use `updateInfo`
CarterLi pushed a commit to CarterLi/iina that referenced this issue Feb 21, 2022
The commit in the pull request:
- Adds the ability to set the state to `NowPlayingInfoManager.updateInfo`
- Eliminates the method  `NowPlayingInfoManager.updateState`
- Changes  `PlayerCore.fileStarted` to set the state to `playing`
- Changes references to `updateState` to use `updateInfo`
CarterLi pushed a commit to CarterLi/iina that referenced this issue Feb 28, 2022
The commit in the pull request:
- Adds the ability to set the state to `NowPlayingInfoManager.updateInfo`
- Eliminates the method  `NowPlayingInfoManager.updateState`
- Changes  `PlayerCore.fileStarted` to set the state to `playing`
- Changes references to `updateState` to use `updateInfo`
CarterLi pushed a commit to CarterLi/iina that referenced this issue Apr 23, 2022
The commit in the pull request:
- Adds the ability to set the state to `NowPlayingInfoManager.updateInfo`
- Eliminates the method  `NowPlayingInfoManager.updateState`
- Changes  `PlayerCore.fileStarted` to set the state to `playing`
- Changes references to `updateState` to use `updateInfo`
low-batt added a commit to CarterLi/iina that referenced this issue Apr 23, 2022
The commit in the pull request:
- Adds the ability to set the state to `NowPlayingInfoManager.updateInfo`
- Eliminates the method  `NowPlayingInfoManager.updateState`
- Changes  `PlayerCore.fileStarted` to set the state to `playing`
- Changes references to `updateState` to use `updateInfo`
lhc70000 pushed a commit that referenced this issue Apr 24, 2022
The commit in the pull request:
- Adds the ability to set the state to `NowPlayingInfoManager.updateInfo`
- Eliminates the method  `NowPlayingInfoManager.updateState`
- Changes  `PlayerCore.fileStarted` to set the state to `playing`
- Changes references to `updateState` to use `updateInfo`
lhc70000 pushed a commit that referenced this issue Apr 24, 2022
The commit in the pull request:
- Adds the ability to set the state to `NowPlayingInfoManager.updateInfo`
- Eliminates the method  `NowPlayingInfoManager.updateState`
- Changes  `PlayerCore.fileStarted` to set the state to `playing`
- Changes references to `updateState` to use `updateInfo`
@low-batt
Copy link
Contributor

The fix in PR #3579 has been merged into the develop branch.

@low-batt
Copy link
Contributor

Closing. Fixed in IINA 1.3.0.

@TheBlinded
Copy link
Author
TheBlinded commented May 31, 2022

Unfortunately I still have the same problem with version 1.3.0 Build 131 and MacOS 12.4

@saagarjha saagarjha reopened this May 31, 2022
@low-batt
Copy link
Contributor

I just finished running a test where on my MacBook Pro with the M1 chip running macOS 12.4 I downloaded and installed IINA 1.3.0 from the main IINA site. I started IINA playing a video. The pause/play button worked and did not startup Music like it did before the fix. Now Playing in the Control Center in the menu bar showed IINA playing the video:

issue-3574-now-playing

It could be that there is another factor at play causing the fix to not work on your machine. I'm confused as to what that could be.

Open IINA Preferences/Key Bindings and double check that "Use system media control" is checked:
issue-3475-preferences

If you find it disabled then please enable it, restart IINA and test the media keys again.

@TheBlinded
Copy link
92A9 Author
TheBlinded commented May 31, 2022

"Use system media control" was unchecked! I activated it and restarted iina and now it works!
Can I suggest that iina enable this option by default? Especially after the update (or maybe I disabled it by mistake a long time ago).
Anyway thanks a lot! The bug has been fixed!

@low-batt
Copy link
Contributor
low-batt commented Jun 1, 2022

Great to hear it is working for you! I checked the code and "Use system media control" is enabled by default. My only guess is that maybe you were testing the effect of this setting while trying to get media keys to work.

I really appreciate you testing the release to confirm the defect is fixed. Very helpful. Thank you for taking the time to report this defect and especially for testing the fix in 1.3.0.

@low-batt low-batt closed this as completed Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0