playing local files (on the client)

825 views
Skip to first unread message

eni

unread,
Apr 8, 2010, 10:13:46 AM4/8/10
to jPlayer: the CSS styleable jQuery audio player plugin
hello at the jplayer dev-team.

i'm trying to play local files in firefox when dragging from the os to
browser. but is it possible to play local files (file:///some/dir/
asong.mp3) with jplayer?
$('blablah')jPlayer("setFile",local_str); seems not to work

thanks for answers..

Mark P

unread,
Apr 9, 2010, 5:13:49 AM4/9/10
to jPlayer: the CSS styleable jQuery audio player plugin
Hello eni,

The flash security restrictions stop you from playing local files. You
could change them for your personal setting of course.
http://www.happyworm.com/jquery/jplayer/latest/developer-guide.htm#jPlayer-flash-security

You might be able to do it in Safari 4 since it plays mp3 natively in
the browser, but I've never even considered drag and drop from the
local file system.

Best regards,
Mark P.

Sean Miller

unread,
Jul 14, 2012, 1:13:58 AM7/14/12
to jpl...@googlegroups.com
On 13 July 2012 22:11, Ben Hudson <bahh...@gmail.com> wrote:
> Sorry to bring back such an old post, but could you please give me some
> updated information about this. To accomplish access to local files through
> jplayer do we need to change settings in jplayer or do we have to accomplish
> it by changing some flash setting.

Why are you trying to play local files? What is your application?

Sean

Ben Hudson

unread,
Jul 15, 2012, 5:24:05 PM7/15/12
to jpl...@googlegroups.com
I would like to be able to let users upload their iTunes library xml file and jPlayer to be able to play their local files through my site (I have a music service application I am building; playlists, sharing music, etc). I am able to read their xml file and get the local paths to all of their songs, so I have that.

Mark Panaghiston

unread,
Jul 16, 2012, 11:18:34 AM7/16/12
to jpl...@googlegroups.com
The problem here is the Flash security sandbox restrictions. You are either on the internet or in the local system. Mixing the sandbox opens up many security vulnerabilities, as the flash can then read local files and send them to the internet.

Not that I am suggesting that you want to do anything malicious... I am simply trying to explain the reason behind the limitation imposed on the Flash plugin.

The user can disable the Flash security if they choose, but it can be a little clunky. They would suddenly get a popup warning from the Flash plugin and the Flash settings would appear. Then can then add their music folder to the list of local files/folders that can be accessed while in the network sandbox.

Waving my arms around... You'd need to upload the iTunes library XML, then explain to the user that they will need to edit their Flash settings to proceed... Then try and play one of the files... Trying to play the file, should make the Flash security popup appear, allowing them to add their folder.

Then there is the situation on modern browsers that support MP3/MP4 natively... Where the flash solution would not be used, nor required. So you'd not have to do all that for those users. But I expect that all Firefox and opera users would need to tweak their Flash settings.

In many ways, what you want is a media server to be installed on the users machine. This server then gives the local files through the network sandbox. In theory, this would then let users listen to their music while on the train via their phone. But obviously these extras are non-trivial.


Ben Hudson

unread,
Jul 16, 2012, 5:12:38 PM7/16/12
to jpl...@googlegroups.com
Thanks for your insight! Right now I when I try to load a local file to jplayer I simply get an "Not allowed to load local resource: file://path_to_file.mpg" logged to the console. I suppose this is through jquery? How would I go about getting the user to tweak their flash security setting? Is there some way to display the flash setting and allow them to change it on the page?

What you described is pretty much what I want to implement. I want users to be able to surf my site where they can play music that is there as well as play their local music files through my site, incorporating both music libraries in one.

Thanks for you help!
Reply all
Reply to author
Forward
0 new messages