Page 15 of 16
Re: SD player UI development
Posted: Wed Sep 12, 2018 12:28 pm
by jkeny
Randy,
You should try Amplitudejs (yes, I'm back considering this as the best solution to our needs)
https://521dimensions.com/open-source/amplitudejs
It's a music player app that is a simple front end for HTML5 which means it will run on any platform. Its Java source is simple enough even for me with many examples of different types of player UI - see examples
https://521dimensions.com/open-source/a ... s/examples
It allows adding in code at events like key presses - so when a file is added to the playlist we can put in the code to send the file to SDP - when Play is pressed we can send the correct IR code to the ESP etc
It has improved since I last looked at it & now has dynamic adding of tracks to playlist - before it was a hard coded playlist - so we can add tracks on the fly
The only? issue I see is to work out the best way to be able to select tracks from our music folders/libraries so that they are added to the AmplitudeJS playlist - it's easy to add a track - just a matter of creating a json object i.e a text list of artist, track, etc in a particular format & using a call to amplitudejs
Re: SD player UI development
Posted: Wed Sep 12, 2018 6:17 pm
by randytsuch
I was thinking some more about this yesterday, during my evening walk.
Here’s my proposal.
The Flashair card support Lua scripts, and I have a tiny bit of experience with Lua. Write a lua script to run at the end of a file transfer, that sends a command to the ESP to start playing a new song.
The ESP will send ir commands to turn off, then on the SDP, then send a button push or two to start playing the file just sent. There will only be one file on the flashair, so it should be easy to start playing a song.
At a PC (or maybe a phone), you have a file manager type program that you use to browse for songs. You select the song, and the program sends a stop playing command (via http and the ESP), then it deletes the current file from the flashair, then sends the new file. The end of the new file transfer kicks off the lua script above.
I have no clue how to do the PC part of this. We could use the program you found, but I’m really not sure what value it adds to this process. You don’t need to keep track of when the song ends. When a new song is selected, you stop the current one, delete it and send the new one.
There is probably open source file manager code out there, and then someone would need to modify that code to add the stuff above when a song is selected.
Re: SD player UI development
Posted: Wed Sep 12, 2018 8:32 pm
by jkeny
randytsuch wrote: ↑Wed Sep 12, 2018 6:17 pm
I was thinking some more about this yesterday, during my evening walk.
Here’s my proposal.
The Flashair card support Lua scripts, and I have a tiny bit of experience with Lua. Write a lua script to run at the end of a file transfer, that sends a command to the ESP to start playing a new song.
I didn't believe Lua could do this - sense when a file transfer has finished that has been started from an external command but then i saw this
https://flashair-developers.com/en/supp ... aring-code
Which seems to be modifiable to what we want?
The ESP will send ir commands to turn off, then on the SDP, then send a button push or two to start playing the file just sent. There will only be one file on the flashair, so it should be easy to start playing a song.
At a PC (or maybe a phone), you have a file manager type program that you use to browse for songs. You select the song, and the program sends a stop playing command (via http and the ESP), then it deletes the current file from the flashair, then sends the new file. The end of the new file transfer kicks off the lua script above.
Yea, this seems to be what we want
I have no clue how to do the PC part of this. We could use the program you found, but I’m really not sure what value it adds to this process. You don’t need to keep track of when the song ends. When a new song is selected, you stop the current one, delete it and send the new one.
Yea, I guess Amplitudejs might be superfluous to our needs, particularly as it still needs a file manager type program to be able to view the contents of a music folder & select a file for playback. I guess I saw it as a more sophisticated playback app which can run on any platform & can include album image but you are correct we don't need pause, next, previous, etc.
There is probably open source file manager code out there, and then someone would need to modify that code to add the stuff above when a song is selected.
Yea, I've been looking for something like this - universal & open source
Re: SD player UI development
Posted: Wed Sep 12, 2018 10:41 pm
by randytsuch
John
Take a look at this
https://flashair-developers.com/en/docu ... e/#method2
Looks pretty simple to start a lua script on a "write event"
Can also start one from a http request, but I write event sounds like what we want.
Re: SD player UI development
Posted: Thu Sep 13, 2018 1:59 pm
by randytsuch
Here is what I decoded for the IR signals
power
Decoded NEC(1): Value:FD00FF Adrs:0 (32 bits)
up
Decoded NEC(1): Value:FDA05F Adrs:0 (32 bits)
right
Decoded NEC(1): Value:FD50AF Adrs:0 (32 bits)
down
Decoded NEC(1): Value:FDB04F Adrs:0 (32 bits)
left
Decoded NEC(1): Value:FD10EF Adrs:0 (32 bits)
enter
Decoded NEC(1): Value:FD906F Adrs:0 (32 bits)
Re: SD player UI development
Posted: Thu Sep 13, 2018 10:02 pm
by jkeny
I'm not really sure what a "write event" is - does it mean a file has been saved to the SD card (usually by a camera)?
When is this "write event" triggered - when the file is finished being written or when it starts being written? This wouldn't be an issue, normally, as a camera write to its Flashair card would be near instant but we are using writing over Wifi. I guess only trying this will answer this question?
Good work on the button IR codes, BTW
Re: SD player UI development
Posted: Thu Sep 13, 2018 11:39 pm
by randytsuch
John
I was looking at this page
https://flashair-developers.com/en/docu ... iot-hub/3/
At the "Upload Image" section in the middle of the page.
This is sending files from the flashair to a server, but the description makes me think that the lua script is executed at the end of a file write.
Makes sense for a camera. In this use case, the camera takes a pic, and then saves the pic to the card. When the pic file is written, then the lua script is executed, in this case to automatically download the pic.
I hoping the card doesn't care who writes the file, and will execute a lua script whenever a file is written, whether over wifi or from the host. In the camera use case, its not expecting files to be written over wifi, but we won't know until we try.
If I get some time, I can see if I can write a file to the card, and get a simple script to execute. I remember from way back when I was able to write files to the card, but I don't remember how I did it anymore.
Do you remember how to write files to the flashair over wifi?
Randy
Re: SD player UI development
Posted: Fri Sep 14, 2018 5:43 pm
by jkeny
I think we can use this player as the front end UI music player
https://one.8ue.nl/# - looks really good (looks like an old turntable) & can run on phone
Open the playlist (top left button) & drag music files to it to play a file
The code is here
http://apls.bliptunes.com/ so we can change whatever we want (It's easy language) - send files to SDP, send button commands to ESP/SDP
APLS.JS is a front end to AmplitudeJS & also has an MIT licence (free to use ) -
https://opensource.org/licenses/MIT
What do you guys think?
Re: SD player UI development
Posted: Fri Sep 14, 2018 8:27 pm
by randytsuch
Hey John
Took a quick look, that looks good, think we are on the right track.
Wondering how hard it is to make the playlists, and if there is any automatic way to do it.
But the json stuff for amplitude was one reason I didn't like that, so this is much better in that regard, I think I could live with this.
Re: SD player UI development
Posted: Fri Sep 14, 2018 9:46 pm
by jkeny
The Demo here
http://apls.bliptunes.com/demo.html shows some more functionality - playlist & Jukebox
Best to start simple & work up to building something more sophisticated once we have a simple working method
The first link I gave seems to answer what we originally wanted - an ability to use file manager & drag files across to be played?
Maybe buttons Play, Stop, Pause should be in the interface
Later we can look at having a playlist, etc.