diff --git a/plugin/Hotkeys/Hotkeys.php b/plugin/Hotkeys/Hotkeys.php index cf9f99991..545a7efb4 100644 --- a/plugin/Hotkeys/Hotkeys.php +++ b/plugin/Hotkeys/Hotkeys.php @@ -1,111 +1,111 @@ Author: Vinzenz Hersche"; } public function getName() { return "Hotkeys"; } public function getPluginVersion() { return "1.1"; } public function getUUID() { return "11355314-1b30-ff15-afb-67516fcccff7"; } public function getHelp(){ $obj = $this->getDataObject(); $html = "

".__('Hotkeys')."

".__("When you are watching media, you can use these keyboard-shortcuts.")."

"; $html .= ""; } else { $html .= __("Volume")."Volume"; } if($obj->Fullscreen){ $html .= ""; } if($obj->PlayPauseKey==" "){ $html .= ""; } else { $html .= ""; } return $html."
".__("Seek")."".__("Left")."/".__("right")."-".__("arrow")."
"; if($obj->ReplaceVolumeWithPlusMinus){ $html .= __("Volume")."+/-
".__("Up")."/".__("Down")."-".__("Arrow")."
".__("Fullscreen")."".$obj->FullscreenKey."
".__("Play")."/".__("pause")."".__("space")."
".__("Play")."/".__("pause")."".$obj->PlayPauseKey."
"; } public function getJSFiles(){ if(isVideo()){ return array("plugin/Hotkeys/videojs.hotkeys.min.js"); } return array(); } public function getEmptyDataObject() { global $global; $obj = new stdClass(); $obj->Volume = true; $obj->ReplaceVolumeWithPlusMinus = true; $obj->Fullscreen = true; $obj->FullscreenKey = "F"; $obj->PlayPauseKey = " "; $obj->AlwaysCaptureHotkeys = true; return $obj; } public function getFooterCode() { global $global; $obj = $this->getDataObject(); if(isVideo()){ - $tmp = ""; + $tmp = "if(typeof player.hotkeys == 'function'){"; $tmp .= "player.hotkeys({ seekStep: 5,"; if($obj->Volume){ $tmp .= "enableVolumeScroll: true,"; } else { // Could not use Up/Down-Keys as excepted. What's the right option? $tmp .= "enableVolumeScroll: false,"; } if($obj->AlwaysCaptureHotkeys){ $tmp .= "alwaysCaptureHotkeys: true,"; } else { $tmp .= "alwaysCaptureHotkeys: false,"; } if($obj->Fullscreen){ $tmp .= "enableFullscreen: true,"; } else { $tmp .= "enableFullscreen: false,"; } if(($obj->FullscreenKey!=="F")||($obj->FullscreenKey!=="")){ $tmp .= "fullscreenKey: function(event, player) { return (event.which ===".ord($obj->FullscreenKey)."); },"; } if(($obj->PlayPauseKey!==" ")||($obj->PlayPauseKey!=="")){ $tmp .= "playPauseKey: function(event, player) { return (event.which ===".ord($obj->PlayPauseKey)."); },"; } if($obj->ReplaceVolumeWithPlusMinus){ $tmp .= "volumeUpKey: function(event, player) { return (event.which === 107); }, volumeDownKey: function(event, player) { return (event.which === 109);},"; } $tmp .= "enableModifiersForNumbers: false - });"; + });}"; PlayerSkins::getStartPlayerJS($tmp); } return ""; } }