mp3 app?

Started by Aubrey, July 19, 2017, 08:50:38 PM

Previous topic - Next topic

Aubrey

Reading an old post
https://www.photools.com/community/index.php?topic=6182.msg42683#msg42683
There is a discussion of " mp3 app" being included with IMatch.

After 30 mins of searching help file/ community I can't find anything. Would somebody point me in the right direction as to where to look?

I'm thinking of archiving music in IMatch....

Thanks,
Aubrey.

Jingo

Interesting.. working on something now to see if it works...

jch2103

#2
Use the Quick View panel to check your MP3s; you should find player controls there. Still works fine in IMatch 2017.
John

Aubrey

John,
Thank you. Found it.
Now some mp3 files play others don't.
I get a message "This format cannot be played" for some mp3 files, others play. Further investigation....

Anyway, not serious this is just a test of using IM for music.

Aubrey.


Jingo

Interesting... thinking of creating an APP anyway..  ::)

jch2103

Quote from: Jingo on July 19, 2017, 09:38:50 PM
Interesting... thinking of creating an APP anyway..  ::)

If I recall correctly, Mario described the MP3 player just as an example of what could be accomplished with the then-current version of IM. So a more full-featured version would be welcome, I'm sure.
John

Jingo

Sounds good.. I already have the basic framework done - stay tuned!

Aubrey

Excellent... Maybe I'll drop iTunes soon ;D

Jingo

#8
Running into a unique problem... my MP3 player seems to work just fine when running in the browser (Chrome/Firefox).. but when running in the APP window, it doesn't work. 

I see in the app window that a particular JS component shows up with the puzzle piece that typically means the plugin is not loaded... in this case - it is a JS library which seems to be of type x-shockware-flash.

Does IMatch block flash JS libraries within the application or does it need a distinct path?  I have the code setup to locate the .js file and since it works in the browser - it seems to finding it ok.



Mario

Flash is dead. Don't use flash for anything. It's dead, dead, dead.
I don't even know if Chromium supports plug-ins. May be off for security reasons.

HTML5 can play MP3 files out of the box, no plug-in needed. Use the <audio> tag in your code: https://www.w3schools.com/html/html5_audio.asp

If you need to play other audio formats, it depends on the format whether or not HTML5 in Chromium can play it:

https://www.chromium.org/audio-video
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Well.. looks like this isn't going to work... Chromium doesn't support MP3 files...(!)  Won't be getting support until v 62.. so putting my code on hold until then.

Just to note: my app currently supports FLAC, WAVE, OGG, and WEBa files... it supports MP3 too and it works just fine in the browser... but IMatch Chromium fails to load the MP3.

Mario

#11
Mhm, I didn't know that Chromium does not support MP3. Probably a licensing or royalties issue.

Update: Yes it was. Just found this on Slashdot:

https://entertainment.slashdot.org/story/17/07/20/1327229/chromium-to-get-support-for-mp3

If your app uses the Flash Player, consider the risk. Flash player (Shockwave) has more security holes than a fishnet, which is why it has banned from many browsers already.

If MP3 makes it into the Chromium base, I will include it in IMatch as well. Until then, just use your external browser. Both IMatch and IMatch WebServices support that.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Yup... I switched over to a different library that is non-flash (believe me - don't like flash myself)...

Perhaps I'll release the app anyway since it works in the browser and just add a note about MP3...

Jingo

Hi Mario - I've run into a stumbling block and curious if you know a way to solve it.

So, JS doesn't allow you to access files stored locally... which kinda defeats the ability to pass a filelist to an MP3 player.  My APP works perfectly with server based files but not local files which was the goal of the player.  It seems you can only access local files by using a FileList but that object cannot be built and is only available by browsing files...

I'm not sure there is a way around this.... which puts this APP to bed.  Do you have a way around this via an IMatch library that can be called from javascript?

Mario

I'M not sure that I understand the problem.

JavaScript is not allowed to access local files, unless in very restricted places. Which is good.
IMWS offers methods to read/write text files in any location to allow script programmers to work with local files.

When you work with IMWS, how do you get "local file names"? I think you used the /files endpoint to get the physical file name of the file, and then handed that over to your MP3 player plug-in? This won't work.

You need a real URL to the file and let IMatch serve this. Then the file is coming "from" the web server and the component will play it. You do this using the endpoint provided to access the original file: /download/fileThis endpoint 'streams' the file through IMWS into the browser.

Use this code fragment to construct an URL that 'points' at the URL from which your player can retrieve the original file:


    function getFileUrl(id) {
        return IMatch.IMWSUrl() + '/v1/download/file?auth_token=' + IMatch.authToken() + '&id=' + id;
    }


Hand the result of this function (supplying the id of the file) to your script as the input. This works with <img> tags, <video> tags, <audio> tags etc.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Thx Mario.. I knew I was overthinking it!  Yup.. this works.... now, I just need to expand the APP beyond the focused file to the selected files.   ;D

Jingo

Well.. its done... nothing all that great given all the restrictions and problems with codecs, etc.. but figured I would upload it anyway.  Head on over to the apps forum and enjoy.