cpd73 wrote: > I -might- enable the playback shortcuts for mobile and desktop, but for > now if you create a file named "custom.js" within a "material-skin" > sub-folder of your LMS's "prefs" folder with the following contents, > then it should work: > > > Code: -------------------- > > > if (IS_MOBILE) { // desktop already catches these shortcuts, so dont want them handled twice! > var playerIsPlaying = false; > Mousetrap.addKeycodes({ // Codes from https://github.com/wesbos/keycodes/blob/gh-pages/scripts.js > 174: 'decvol', > 175: 'incvol', > 182: 'decvolfirefox', > 183: 'incvolfirefox' > }) > // 'bind' keys that we are interested in > bindKey('up', 'alt', true); > bindKey('down', 'alt', true); > bindKey('space'); > bindKey('decvol', undefined, true); > bindKey('incvol', undefined, true); > bindKey('decvolfirefox', undefined, true); > bindKey('incvolfirefox', undefined, true); > bindKey('left', 'alt', true); > bindKey('right', 'alt', true); > > // Act on keys being pressed > bus.$on('keyboard', function(key, modifier) { > // Ignore shortcurt if there is no player or we have a menu/dialog open > if (!store.state.player || store.state.visibleMenus.size>0 || (store.state.openDialogs.length>0 && store.state.openDialogs[0]!='info-dialog')) { > return; > } > var command = undefined; > if (undefined==modifier) { > if (key=='space') { > command=[playerIsPlaying ? 'pause' : 'play']; > } else if (key=='incvol' || key=='incvolfirefox') { > bus.$emit('adjustVolume', true); > } else if (key=='decvol' || key=='decvolfirefox') { > bus.$emit('adjustVolume', false); > } > } else if ('alt'==modifier) { > if (key=='up') { > bus.$emit('adjustVolume', true); > } else if (key=='down') { > bus.$emit('adjustVolume', false); > } else if (key=='left') { > command=['button', 'jump_rew']; > } else if (key=='right') { > command=['playlist', 'index', '+1']; > } > } > > if (command) { > lmsCommand(store.state.player.id, command).then(({data}) => { > bus.$emit('updatePlayer', store.state.player.id); > }); > } > }); > > // Need to keep trak of whether current player is playing or not, so know when to play and when to pause > bus.$on('playerStatus', function(playerStatus) { > playerIsPlaying = playerStatus.isplaying; > }); > } > -------------------- > >
This works perfectly. Thank you! Everything is inching closer to being perfect. ------------------------------------------------------------------------ shinedou's Profile: http://forums.slimdevices.com/member.php?userid=72027 View this thread: http://forums.slimdevices.com/showthread.php?t=109624 _______________________________________________ plugins mailing list plugins@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/plugins