Skip to content

Commit

Permalink
Add ChannelUp, ChannelDown and Tools support for Tizen OS and handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Fazzani committed Dec 7, 2024
1 parent 94bbc84 commit ee03972
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 70 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
- [Connor Smith](https://github.com/ConnorS1110)
- [iFraan](https://github.com/iFraan)
- [Ali](https://github.com/bu3alwa)
- [Heni FAZZANI](https://github.com/fazzani)

## Emby Contributors

Expand Down
9 changes: 8 additions & 1 deletion src/components/cardbuilder/cardBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,14 @@ function getHoverMenuHtml(item, action) {
const btnCssClass = 'cardOverlayButton cardOverlayButton-hover itemAction paper-icon-button-light';

if (playbackManager.canPlay(item)) {
html += '<button is="paper-icon-button-light" class="' + btnCssClass + ' cardOverlayFab-primary" data-action="resume"><span class="material-icons cardOverlayButtonIcon cardOverlayButtonIcon-hover play_arrow" aria-hidden="true"></span></button>';
// Only TvChannel navigation into the current page is currently supported
action = item.Type == "TvChannel" ? "playallfromhere" : "resume";

Check failure on line 1152 in src/components/cardbuilder/cardBuilder.js

View workflow job for this annotation

GitHub Actions / Quality checks 👌🧪 / Run lint 🕵️‍♂️

Strings must use singlequote

Check failure on line 1152 in src/components/cardbuilder/cardBuilder.js

View workflow job for this annotation

GitHub Actions / Quality checks 👌🧪 / Run lint 🕵️‍♂️

Strings must use singlequote

Check failure on line 1152 in src/components/cardbuilder/cardBuilder.js

View workflow job for this annotation

GitHub Actions / Quality checks 👌🧪 / Run lint 🕵️‍♂️

Strings must use singlequote
html +=

Check failure on line 1153 in src/components/cardbuilder/cardBuilder.js

View workflow job for this annotation

GitHub Actions / Quality checks 👌🧪 / Run lint 🕵️‍♂️

'+=' should be placed at the beginning of the line
'<button is="paper-icon-button-light" class="' +

Check failure on line 1154 in src/components/cardbuilder/cardBuilder.js

View workflow job for this annotation

GitHub Actions / Quality checks 👌🧪 / Run lint 🕵️‍♂️

'+' should be placed at the beginning of the line
btnCssClass +

Check failure on line 1155 in src/components/cardbuilder/cardBuilder.js

View workflow job for this annotation

GitHub Actions / Quality checks 👌🧪 / Run lint 🕵️‍♂️

'+' should be placed at the beginning of the line
' cardOverlayFab-primary" data-action="' +

Check failure on line 1156 in src/components/cardbuilder/cardBuilder.js

View workflow job for this annotation

GitHub Actions / Quality checks 👌🧪 / Run lint 🕵️‍♂️

'+' should be placed at the beginning of the line
action +

Check failure on line 1157 in src/components/cardbuilder/cardBuilder.js

View workflow job for this annotation

GitHub Actions / Quality checks 👌🧪 / Run lint 🕵️‍♂️

'+' should be placed at the beginning of the line
'"><span class="material-icons cardOverlayButtonIcon cardOverlayButtonIcon-hover play_arrow" aria-hidden="true"></span></button>';
}

html += '<div class="cardOverlayButton-br flex">';
Expand Down
51 changes: 33 additions & 18 deletions src/components/playback/playbackmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -4175,49 +4175,64 @@ export class PlaybackManager {
sendCommand(cmd, player) {
console.debug('MediaController received command: ' + cmd.Name);
switch (cmd.Name) {
case 'SetRepeatMode':
case "SetRepeatMode":

Check failure on line 4178 in src/components/playback/playbackmanager.js

View workflow job for this annotation

GitHub Actions / Quality checks 👌🧪 / Run lint 🕵️‍♂️

Strings must use singlequote
this.setRepeatMode(cmd.Arguments.RepeatMode, player);
break;
case 'SetShuffleQueue':
case "SetShuffleQueue":

Check failure on line 4181 in src/components/playback/playbackmanager.js

View workflow job for this annotation

GitHub Actions / Quality checks 👌🧪 / Run lint 🕵️‍♂️

Strings must use singlequote
this.setQueueShuffleMode(cmd.Arguments.ShuffleMode, player);
break;
case 'VolumeUp':
case "VolumeUp":
this.volumeUp(player);
break;
case 'VolumeDown':
case "VolumeDown":
this.volumeDown(player);
break;
case 'Mute':
case "ChannelUp":
this.nextTrack(player);
break;
case "ChannelDown":
this.previousTrack(player);
break;
case "Mute":
this.setMute(true, player);
break;
case 'Unmute':
case "Unmute":
this.setMute(false, player);
break;
case 'ToggleMute':
case "ToggleMute":
this.toggleMute(player);
break;
case 'SetVolume':
case "SetVolume":
this.setVolume(cmd.Arguments.Volume, player);
break;
case 'SetAspectRatio':
case "SetAspectRatio":
this.setAspectRatio(cmd.Arguments.AspectRatio, player);
break;
case 'PlaybackRate':
case "PlaybackRate":
this.setPlaybackRate(cmd.Arguments.PlaybackRate, player);
break;
case 'SetBrightness':
case "SetBrightness":
this.setBrightness(cmd.Arguments.Brightness, player);
break;
case 'SetAudioStreamIndex':
this.setAudioStreamIndex(parseInt(cmd.Arguments.Index, 10), player);
case "SetAudioStreamIndex":
this.setAudioStreamIndex(
parseInt(cmd.Arguments.Index, 10),
player
);
break;
case 'SetSubtitleStreamIndex':
this.setSubtitleStreamIndex(parseInt(cmd.Arguments.Index, 10), player);
case "SetSubtitleStreamIndex":
this.setSubtitleStreamIndex(
parseInt(cmd.Arguments.Index, 10),
player
);
break;
case 'SetMaxStreamingBitrate':
this.setMaxStreamingBitrate(parseInt(cmd.Arguments.Bitrate, 10), player);
case "SetMaxStreamingBitrate":
this.setMaxStreamingBitrate(
parseInt(cmd.Arguments.Bitrate, 10),
player
);
break;
case 'ToggleFullscreen':
case "ToggleFullscreen":
this.toggleFullscreen(player);
break;
default:
Expand Down
122 changes: 71 additions & 51 deletions src/scripts/keyboardNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,40 @@ import appSettings from './settings/appSettings';
* Key name mapping.
*/
const KeyNames = {
13: 'Enter',
19: 'Pause',
27: 'Escape',
32: 'Space',
37: 'ArrowLeft',
38: 'ArrowUp',
39: 'ArrowRight',
40: 'ArrowDown',
13: "Enter",
19: "Pause",
27: "Escape",
32: "Space",
37: "ArrowLeft",
38: "ArrowUp",
39: "ArrowRight",
40: "ArrowDown",
// MediaRewind (Tizen/WebOS)
412: 'MediaRewind',
412: "MediaRewind",
// MediaStop (Tizen/WebOS)
413: 'MediaStop',
413: "MediaStop",
// MediaPlay (Tizen/WebOS)
415: 'MediaPlay',
415: "MediaPlay",
// MediaFastForward (Tizen/WebOS)
417: 'MediaFastForward',
417: "MediaFastForward",
// ChannelUp (Tizen)
427: "ChannelUp",
// ChannelDown (Tizen)
428: "ChannelDown",
// Back (WebOS)
461: 'Back',
461: "Back",
// Back (Tizen)
10009: 'Back',
10009: "Back",
// ChannelList (Tizen)
10073: "ChannelList",
// Tools (Tizen) => shows settings
10135: "Tools",
// MediaTrackPrevious (Tizen)
10232: 'MediaTrackPrevious',
10232: "MediaTrackPrevious",
// MediaTrackNext (Tizen)
10233: 'MediaTrackNext',
10233: "MediaTrackNext",
// MediaPlayPause (Tizen)
10252: 'MediaPlayPause'
10252: "MediaPlayPause",
};

/**
Expand Down Expand Up @@ -143,78 +151,90 @@ export function enable() {
let capture = true;

switch (key) {
case 'ArrowLeft':
case "ArrowLeft":
if (!isInteractiveElement(document.activeElement)) {
inputManager.handleCommand('left');
inputManager.handleCommand("left");
} else {
capture = false;
}
break;
case 'ArrowUp':
inputManager.handleCommand('up');
case "ArrowUp":
inputManager.handleCommand("up");
break;
case 'ArrowRight':
case "ArrowRight":
if (!isInteractiveElement(document.activeElement)) {
inputManager.handleCommand('right');
inputManager.handleCommand("right");
} else {
capture = false;
}
break;
case 'ArrowDown':
inputManager.handleCommand('down');
case "ArrowDown":
inputManager.handleCommand("down");
break;

case 'Back':
inputManager.handleCommand('back');
case "Back":
inputManager.handleCommand("back");
break;

// HACK: Hisense TV (VIDAA OS) uses Backspace for Back action
case 'Backspace':
case "Backspace":
if (browser.tv && browser.hisense && browser.vidaa) {
inputManager.handleCommand('back');
inputManager.handleCommand("back");
} else {
capture = false;
}
break;

case 'Escape':
case "Escape":
if (layoutManager.tv) {
inputManager.handleCommand('back');
inputManager.handleCommand("back");
} else {
capture = false;
}
break;

case 'Find':
inputManager.handleCommand('search');
case "Find":
inputManager.handleCommand("search");
break;
case 'BrowserHome':
inputManager.handleCommand('home');
case "BrowserHome":
inputManager.handleCommand("home");
break;

case 'MediaPlay':
inputManager.handleCommand('play');
case "MediaPlay":
inputManager.handleCommand("play");
break;
case 'Pause':
inputManager.handleCommand('pause');
case "Pause":
inputManager.handleCommand("pause");
break;
case 'MediaPlayPause':
inputManager.handleCommand('playpause');
case "MediaPlayPause":
inputManager.handleCommand("playpause");
break;
case 'MediaRewind':
inputManager.handleCommand('rewind');
case "MediaRewind":
inputManager.handleCommand("rewind");
break;
case 'MediaFastForward':
inputManager.handleCommand('fastforward');
case "MediaFastForward":
inputManager.handleCommand("fastforward");
break;
case 'MediaStop':
inputManager.handleCommand('stop');
case "MediaStop":
inputManager.handleCommand("stop");
break;
case 'MediaTrackPrevious':
inputManager.handleCommand('previoustrack');
case "MediaTrackPrevious":
inputManager.handleCommand("previoustrack");
break;
case 'MediaTrackNext':
inputManager.handleCommand('nexttrack');
case "MediaTrackNext":
inputManager.handleCommand("nexttrack");
break;
case "ChannelUp":
inputManager.handleCommand("channelup");
break;
case "ChannelDown":
inputManager.handleCommand("channeldown");
break;
case "ChannelList":
inputManager.handleCommand("livetv");
break;
case "Tools":
inputManager.handleCommand("settings");
break;

default:
Expand Down

0 comments on commit ee03972

Please sign in to comment.