-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Added MediaSession support (notification controls on mobile) #187
base: master
Are you sure you want to change the base?
Conversation
One ugly hack I had to add is an |
import PlayerModel from "./player_model"; | ||
import silenceMp3 from "./5-seconds-of-silence.mp3"; | ||
|
||
export default class MediaSessionController { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting does not match other files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to single quotes and tab width 4
); | ||
|
||
this.dataSource.on("player", (player) => this.updateMetadata(player)); | ||
this.dataSource.watch("player", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one type can watch on data source, this logic should be in PlayerModel instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to PlayerModel, but it should probably be refactored later because the activeItem's columns are becoming messy
js/webui/webpack.config.js
Outdated
loader: 'url-loader', | ||
options: { | ||
name: '[name].[ext]', | ||
limit: 1024 | ||
} | ||
}); | ||
|
||
config.optimization = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks unrelated to this PR, besides that I'm not sure if there is a benefit of having vendors chunk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's out of scope of this PR, but the added code pushed the bundle over 300KB, breaking the build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The limit is raised in other PR, probably you can do the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed code splitting and raised bundle limit
@R0nd, |
This has possible unintended effect effect of draining mobile battery for playing silence. |
I've added a setting to enable this feature. I've made it disabled by default, since there's no data on performance impact yet and browser support isn't 100% there. |
@R0nd sorry for delay, I'm on vacation at the moment, would merge it when I'm back, have a nice day! |
Probably it would be better to avoid Brace formatting still does not match other source files: |
Implemented MediaSession support (show playing track and expose playback controls in a notification on mobile). Works great in Chrome, somewhat buggy in Firefox Nightly for now (no prev/next buttons, incorrect playback state).