File (Entry) to Src

33 views
Skip to first unread message

Si Robertson

unread,
Mar 23, 2015, 10:38:01 PM3/23/15
to chromi...@chromium.org
Hi,

I apologize in advanced if this is a dumb question but it has me stumped at the moment. After a user has chosen an audio file from their local file system (chrome.fileSystem.chooseEntry) how do I convert the file path to a value that can be used as the src attribute value of an audio element?

It would be foolish to load an entire audio file into memory and convert it to an object URL (which could be used as a src value) so there must be something I'm overlooking in the Chrome Apps API.

Thanks.

Rob Wu

unread,
Mar 24, 2015, 7:24:35 AM3/24/15
to Si Robertson, Chromium Apps
The callback of chrome.fileSystem.chooseEntry receives an Entry object (http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#the-entry-interface). This object has a method toURL() which seems to match your needs.

Kind regards,
 Rob
 https://robwu.nl

--
You received this message because you are subscribed to the Google Groups "Chromium Apps" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-app...@chromium.org.
To post to this group, send email to chromi...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-apps/.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

Si Robertson

unread,
Mar 24, 2015, 7:56:34 AM3/24/15
to Rob Wu, Chromium Apps
Hi Rob,

Unfortunately the toURL() method silently throws an error, as does the file() method :(

One solution is to copy the select file to the application directory and access the copy. However, if someone selects a massive audio file then it could take a good amount of time to copy the file before anything could be done with it, and that wouldn't be a very nice user experience. There would also be the issue of the application possibly consuming large amounts of HDD/SSD space.

// Si

Victor Khimenko

unread,
Mar 24, 2015, 8:20:21 AM3/24/15
to Si Robertson, Chromium Apps
I'm just not sure... it looks like question was already asked and answered on Stack Overflow:

Why duplicate it here?

Si Robertson

unread,
Mar 24, 2015, 8:29:25 AM3/24/15
to Victor Khimenko, Chromium Apps
Why duplicate it here?

Because I was unaware a similar question existed on that website.

Paul McGahuey

unread,
Mar 24, 2015, 8:43:01 AM3/24/15
to Si Robertson, Victor Khimenko, Chromium Apps
I log on to my  mother's computer when someone took ActiveX and hijacked my settings I lost control also they have been downloading sites on to my network that where I've not been I bailed out Hostel people running my site putting websites making their own plans is not working I'm supposed to be the one if you got ideas that's what emails are about supposed to write set plans you don't hijack and take over somebody's computer when it's not even mine you trust past it into another person's land I have permissions you need to fix the settings on that computer
Reply all
Reply to author
Forward
0 new messages