Global Hotkeys via Media Session
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript, typescript
Research direction
Start with the linked MDN MediaSession documentation and verify browser support, including whether active audio is required. Then locate the application's existing global-hotkey entry point and determine how media actions should connect to it. Done means supported media-key actions reliably invoke the intended handlers.
Written by the indexing model from the issue text.
Description
Looks like it is indeed possible to have yet another form of global hotkeys. We can start a media session and pretend we are playing music, at which point the browser will forward any key presses of the media keys on your keyboard (or any other way of pausing, playing, skipping, ... the current song, such as pressing buttons on your headphones) to custom JavaScript code you can execute:
https://developer.mozilla.org/en-US/docs/Web/API/MediaSession
if ('mediaSession' in navigator){
navigator.mediaSession.metadata = new MediaMetadata({
title: "Podcast Episode Title",
artist: "Podcast Host",
album: "Podcast Name",
artwork: [{src: "podcast.jpg"}]
});
navigator.mediaSession.setActionHandler('play', function() {});
navigator.mediaSession.setActionHandler('pause', function() {});
navigator.mediaSession.setActionHandler('seekbackward', function() {});
navigator.mediaSession.setActionHandler('seekforward', function() {});
navigator.mediaSession.setActionHandler('previoustrack', function() {});
navigator.mediaSession.setActionHandler('nexttrack', function() {});
}
Seems like you may need to play some actual audio or so for this to work.
- Dominant language
- TypeScript
- Stars
- 301
- Forks
- 55
- Avg merge
- 8m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from LiveSplit/LiveSplitOne
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
LiveSplit/LiveSplitOne#1162 ·
-
enhancement suitable for contributions UI
Difficulty 5/5 Over a week Newbie friendliness 35/100
LiveSplit/LiveSplitOne#1139 ·
-
enhancement suitable for contributions UI
Difficulty 4/5 3-5 days Newbie friendliness 45/100
LiveSplit/LiveSplitOne#1138 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
LiveSplit/LiveSplitOne#1129 · 12 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
LiveSplit/LiveSplitOne#1121 ·
All issues in LiveSplit/LiveSplitOne
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ontola/atomic-server#1625 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
melgarafael/DeskcommCRM#1451 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bot:ai-assisted component:compact-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
midnightntwrk/midnight-sdk#403 ·