ltguillaume/music-folder-player

Smart TV operation using numeric buttons on remote

nnjim opened this issue ยท 30 comments

nnjim commented

This is a great player which works really well, Thank you!

A couple of ideas that I think will make it even better.

As well as using this player on my mobile devices, I've found it works really well on my Smart TV (Panasonic) hooked up to a decent sound system.

Unfortunately it is very awkward to navigate the TV's browser mouse using the TV IR remote arrow keys. I've discovered that the remote number keys are passed through to the browser, so '0' key does pause the player. Can the other number keys (1-9) be mapped to make the player so that play lists can be selected and started?

Also could a number key be mapped to dim the screen so it acts as a 'screen saver'? I have attempted this using a dark (90% translucent) overlay toggle function mapped to key '1', and it does work except some of the margins don't get overlayed fully.

Many thanks, keep up the good work!

Hi! That's interesting to know. I tried running MFP on a not-so-new Samsung TV and it was obvious that some of the JavaScript was too new (even though I've tried to keep it as compatible as possible). Debugging that would probably be possible via the Development mode of the TV, but I didn't really want to dig into it that deep.

I've added a dim feature and three new hotkeys, see 34c9d01

How's that?

nnjim commented

Hi, Many thanks for doing this - and so quickly too!

I've just tried it and yes it works as planned!

The only minor issue I have now (and I don't think there's any way round it) is that the TV mouse cursor stays on. I tried previously on a web page to hide or change the cursor and it seems this particular TV browser will allow an alternative cursor eg crosshairs or egg timer etc, but it wont allow to turn off the cursor or to set an alternative cursor image file. It just means that I have to move the mouse to the side.

Thank you again for this very useful project and for updating it as requested!

Regards Jim

So I guess you can't use the cursor keys to browse the library, then? That would've made it perfect.

I could maybe change the hotkeys to include more of the relevant features:

Key Key Key
1 = Enqueue 2 = Random 3 = Crossfade
4 = Previous 5 = Play/Pause 6 = Next
7 = Focus search 8 = Lock? 9 = Dim
-- 0 = Stop --

Hi, Many thanks for doing this - and so quickly too!

That's because I always wanted this to work nicely on TVs, too, but I gave up on it after seeing two Samsung TVs (one rather new) botching it completely and no way to easily debug.

nnjim commented

I've just discovered the website keycode.info - which very usefully shows any passed through keycodes on the browser.

The only keys that get passed through apart from 0-9 (codes 48 - 57) is the program up/down rocker which gives codes of 33 (up) and 34 (down) The remote's cursor keys don't get through because (of course) they move the mouse cursor.

My TV is a Panasonic TX-43GS352B and is about a year old. It is only a basic smart TV - it is very limited in the apps that can be loaded onto it which is why your MFP is so useful. I do also have a slightly older Panasonic HDD recorder, which has smart features like an inbuilt browser, but that unfortunately won't run MFP.

What you propose for the key functions would be good. In addition, I don't know how feasible it would be to have playlists selectable purely by using keys? I think that would be the icing on the cake. Also, maybe to have the album list rolled up by default?

The way I will use MFP is that I'll set up all my playlists using a PC or tablet, and then use the TV to select and play those playlists. The Enqueue and Focus search keys are less useful for me on the TV, because I would still need to use the very clunky onscreen keyboard to input track names to search for.

Thanks again for your efforts, I'm sure many others will find this a worthwhile application!

Jim

Great! That's what I wanted to know! I was already wondering if the Program Up/Down could be used for Next/Previous ๐Ÿ™‚

. . . .
1 = Toggle Enqueue 2 = Up 3 = Random PrgUp = Next
4 = Left 5 = Enter 6 = Right --
7 = Focus search 8 = Down 9 = Dim PrgDown = Previous
. 0 = Play/Pause

Missing a key for Random and Crossfade, don't know if that would be a problem.

See 6662131

nnjim commented

Hi, I've tried your latest amendments (thanks!)

It mostly works, but there's a couple of peculiar things;

The up program (33) button starts the previous track on the playlist, and down program button starts the next track - but it also pushes the playlist up off the top so all you can see is some random part of the folder list? (you can see the effect by using the page up and page down keys when running this on a PC browser)

The other issue - which might mean the search feature being a non starter here - is that when button 7 is pushed it changes the focus to the search textbox - so far so good! However all the numeric keys no longer get passed through but instead act as T9 text/numeric input for the text box. This means that you can't get out of that box without using the remote mouse. Again you can see the effect on a PC browser, once key 7 is pressed, you have to use the mouse to get out of the text box.

Is it possible instead of searching for tracks, to have a way of selecting and loading playlists already stored in the music.pls folder by using the numeric keys?

Really appreciate your work with this!

Jim

As you can see in the code, I set 33 to play the next song, so I guess the codes 33 and 34 are actually reversed?

I didn't check before what those codes actually mean, but they're PageUp and PageDown then? Ok I'm not sure if it's wise to use those for next/previous then, because with large libraries it can be very useful to have the actual PageUp/PageDown function working. I definitely don't want desktop users not being able to use them.

As for the playlist focus issue, I'll look into it.

As for loading playlists... that could work, but only after I implement arrow keys for those menus, too.

nnjim commented

The codes are the same as pgeup down 33/34. (going to https:\keycode.info and pressing those keys confirms this.) Possibly that is why the up button (33) is selecting the next track because it is scrolling the list up behind the scenes? And the page down key is possibly moving the focus to the folder list. As you say best not to use Page up and down codes :(

Thanks!

Jim

I just tested it, but I cannot confirm what you're saying about PgUp/PgDown: PgUp does play the next song for my, while PgDown plays the previous.

But there's something to say to reverse them: for the next item to play, you go down the list. On the other hand on TVs the button often says P+ for (Up) and P- (Down). Video players, on the other hand, often use PageUp for next item in the playlist, just like I implemented it from the start.

As for pushing the page up/down, that's fixed now. Maybe I can disable these PgUp/PgDn hotkeys on desktops only, while keeping them intact for TVs.

I have also made it possible to go through menus (Load Playlist and After Playlist) via arrow keys.

7 is now set to open the Load Playlist menu.

See b92c6b1

nnjim commented

Getting closer, but there still seems to be a slight problem;

The same thing happens on both my TV and on my win10 PC using the MS Edge browser.

I can bring up the playlist list using the 7 key, then I can highlight a playlist using the 2 or 8 keys. But then key 5 has no effect either on the PC or the TV to actually load that playlist. It's as though key 5 is disabled when the playlist list is popped up. However at that point on the PC I can press the 'Enter' key and playlist loads correctly.

Thanks,

Jim

I simply forgot to test the 5 key, please stand by.

The same thing happens on both my TV and on my win10 PC using the MS Edge browser.

Do you mean the "5" issue explained below that sentence, or do you mean a previously described issue?

nnjim commented

Sorry yes the issu below that sentence....

nnjim commented

Meant to add that the 5 key does work when a track is highlighted, but when the playlist list has popped up the 5 key does nothing until the playlist list is toggled off again by pressing 7.

I know, it was only triggered within the library tree...

c18fc9a should work.

I'm revisiting issues with Shift+Enter, though. It should trigger the right-click action, but it doesn't. Really strange stuff.

nnjim commented

You have fixed the issue with button 5! It is now (for me anyway) a usable system on my TV just using the remote buttons without needing the clunky mouse cursor keys!

Many thanks again with your help with this.

Is there a way I can make a small donation to your coffee/beer fund?

Jim

I think it makes more sense to have the option to zoom the artwork on a TV:

โ€Ž โ€Ž โ€Ž โ€Ž
1 = Toggle Enqueue 2 = Up 3 = Zoom PrgUp = Next
4 = Left 5 = Enter 6 = Right
7 = Load Playlist 8 = Down 9 = Dim PrgDown = Previous
โ€Ž 0 = Play/Pause

Thanks for offering to buy me a beer, much appreciated ๐Ÿ˜Š I have looked previously into adopting one of those donation platforms, but I couldn't really find a (privacy-friendly) one.

I'm using a very simple check for Smart TV's now in the master branch, so that numerical hotkeys and PgUp/PgDn are only used on those devices. Could you check if all is still working?

nnjim commented

Yes it works on the TV and PC - well done!

I'm not sure how useful the enqueue key would be on the TV? Maybe that button could clear the current playlist instead - which I or my wife would much more likely use when we choose different playlists.

I've noticed that on the TV the crossfade when enabled doesn't work on the TV; when a track finishes the next track is queued up correctly but it doesn't start, I have to manually start it. I can't say for sure whether this ever worked on the TV. Only a minor thing though, it might be fine on other TVs.

The toggle enqueue button is vital in creating a playlist, otherwise every song will start playing as soon as you add it.

I'm not sure I can help with the crossfade issue, unless you can somehow get a browser console or a debugging interface on your TV. It's undoubtedly possible in some developer mode, don't know how easy it is to gain access to it, though.

nnjim commented

That's my point though, I will never use my TV to create or add to a playlist - I will do this on my PC or tablet. The TV will just be a dumb player and used to load and play existing playlists. This is why I would prefer a clear playlist button and also why I would like the folder list to be closed by default when the MFP is started on the TV. If I ever did want to add tracks while on the TV I could still do that with the clunky mouse but I can't see I'm often going to do that.

I do like the zoom artwork button :)

Thanks
Jim

I will, so I win ๐Ÿ˜‰

In your case, you can make use of the share feature for playlists. Just bookmark the playlist(s) directly. That will clear the playlist if you switch to another playlist,or refresh it, and the library will not be shown.

Otherwise, it's quite easy to move the line with // 1 above the line with // C in music.js

nnjim commented

I will, so I win ๐Ÿ˜‰

Ok. I'll concede that!

In your case, you can make use of the share feature for playlists. Just bookmark the playlist(s) directly. That will clear the playlist if you switch to another playlist,or refresh it, and the library will not be shown.

Otherwise, it's quite easy to move the line with // 1 above the line with // C in music.js

I've just tried creating a bookmark for a playlist on the PC, and that works well! However on the TV I can't find a way of pasting the url saved on the clipboard. I guess I'll have to type the URL links to each playlist into each bookmark.

I hadn't investigated all the playlist share options because the other share features that I tried before don't work on my Win10 PC. EG save file or folder just creates music.js file that contains the sentence "File not found" It could be simply be that I need to enable a PHP zip function in my XAMPP, I haven't looked at that yet.

Download folder needs zip, yeah. Download song should work.

As for sharing, that's just a URL, so I guess you only meant the download feature that didn't work?

nnjim commented

Download folder needs zip, yeah. Download song should work.

No, neither song or folder downloads work on my Win10 PC

Its strange but the symptoms don't seem consistent. Most of the time downloading a song or folder creates music.js file containing just one line 'File not found'

But, interestingly I've just tried it again without first loading a saved playlist (just selected a few tracks to play) and by trying to download either folder or song, it created the music.js file as attached! (I've renamed it to a txt file and cut it short as it contained a full list of my library - about 4000 tracks)

Also if I try the 'copy link to clipboard' for either a song or folder it produces this url (which does change but always has the same effect)
http://192.168.8.2/t/?play=c:Li4vbGlicmFyeS9BbGljZSBEZWVqYXkvV2hvIE5lZWRzIEd1aXRhcnMgQW55d2F5Xw%3D%3D

If I paste this into a browser it always brings up MFP with just the very first track in my library loaded on its own. That first track is not in any of my playlists

As for sharing, that's just a URL, so I guess you only meant the download feature that didn't work?

Yes I don't use Whatsapp so can't test that.

music.js.txt

Aha! That's because I fucked up. It should be fixed now.

nnjim commented

I'm afraid it hasn't quite worked for me....

Now when I open the share panel I can see the download links appear to be listed 'in english' now (see below)*, (prevoiusly it showed encoded urls on those two lines) but it still copies the encoded url onto the clipboard, which then won't work when pasted into a browser.

The music file downloads still create music.js files as before.

  • Incidentally, now I can see the two links 'in english' I can see that you have them reversed, the single file download is on the library download line and vice versa.

Ugh, I didn't commit the right music.js yet. It's here now. Sry for that.

The playlist URLs should remain "in English", the other two are encoded, but only in the clipboard now.

nnjim commented

Sorry, I've been away for a while.
I've just refreshed everything with the latest version, and tested on a PC

In the sharing panel;
Selecting a playlist and then copy playlist to clipboard icon works correctly.

The song and folder text is now the correct way round, but
Clicking either the 'download song' or 'download folder' icons still produces a music.js file

Clicking either the 'copy song link to clipboard' or 'copy folder link to clipboard' icons produces an encoded link which when used just loads and plays the very first song in my library even though the correct song or folder is correctly showing to the left of those icons.

Issue #33 is about this, too. Shall we continue the discussion there? Please check my reply there.