LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How do I make Firefox run vlc with URL? (https://www.linuxquestions.org/questions/linux-general-1/how-do-i-make-firefox-run-vlc-with-url-884264/)

zzyxx 06-03-2011 01:30 AM

How do I make Firefox run vlc with URL?
 
I have a server that delivers media via HTTP (or FTP). If I click on a link, it downloads to /tmp and then plays in vlc, but what I want is for it to run vlc and give it the URL so that it will play it as a stream. I am generating the HTML and I'm using thttpd for the server. If I do it manually (Copy Link Location, paste into vlc) it works fine, but I'd like click-and-play. I've Googled for hours and can't even see the topic addressed. This is possible, right?

(Lucid-64, XFCE, Firefox 4.0b11, thttpd, vlc 1.0.6)

ButterflyMelissa 06-03-2011 01:36 AM

Hi,

If it's your (private) server, consider setting up IceCast...full details on install and setting up are on the site! Dunnow what distro you got, but have a peek in the repo, it's bound to be in there...

Happy listening :)

Thor

zzyxx 06-03-2011 02:35 AM

Quote:

Originally Posted by Thor_2.0 (Post 4374780)
Hi,

If it's your (private) server, consider setting up IceCast...full details on install and setting up are on the site! Dunnow what distro you got, but have a peek in the repo, it's bound to be in there...

Happy listening :)

Thor

Thanks, but actually I was wanting to stream video.

But even with Icecast, what program would be reading it in the browser?
That's the problem I have is making it stream on the client side.

16pide 06-03-2011 03:55 AM

Quote:

Originally Posted by zzyxx (Post 4374777)
vlc 1.0.6)

that version is old! latest right now is 1.1.9
Also, you could install mozilla-vlc package. It's a plug-in, and might let you do play your videos while they download instead of waiting for the end of the download.

Another way of achieving what you want could be to download a playlist file that holds the URL for your media, instead of the media file itself. But you'll need to research what exact format vlc supports for this.

m3u would work if your media is mp3.

XSPF format could be what you want, not sure. http://en.wikipedia.org/wiki/XSPF mentions vlc

16pide 06-03-2011 04:12 AM

I checked http://en.wikipedia.org/wiki/XSPF that i mentioned above, and it works on first try on vlc 1.1.9

zzyxx 06-03-2011 09:26 PM

Quote:

Originally Posted by 16pide (Post 4374869)
that version is old! latest right now is 1.1.9

OK, but I don't get how upgrading to a newer version would help.
The problem is in getting Firefox to do the correct thing.

Quote:

Originally Posted by 16pide (Post 4374869)
Also, you could install mozilla-vlc package. It's a plug-in, and might let you do play your videos while they download instead of waiting for the end of the download.

Nope. I already have that installed and it downloads to /tmp, then plays.

Quote:

Originally Posted by 16pide (Post 4374869)
Another way of achieving what you want could be to download a playlist file that holds the URL for your media, instead of the media file itself. But you'll need to research what exact format vlc supports for this.

m3u would work if your media is mp3.

XSPF format could be what you want, not sure. http://en.wikipedia.org/wiki/XSPF mentions vlc

OK, but how would that make it stream? Will that give a playlist to vlc?
Would that not expect that the media to play was on the local machine?

I will investigate that though. Thanks.

16pide 06-05-2011 02:46 AM

Quote:

Originally Posted by zzyxx (Post 4375778)
OK, but how would that make it stream? Will that give a playlist to vlc?
Would that not expect that the media to play was on the local machine?

I will investigate that though. Thanks.

The idea is that getting the xspf file takes under a second (a few lines of xml). Then vlc gets it from the browser, analyses it, finds a http url in it, and then plays that http url while downloading it.

I tried it (my post above), and could start viewing my video immediately which is what I think you're looking for.

if your version 1.0.6 of vlc does not work with that xspf standard, then upgrade to 1.1.9

zzyxx 06-05-2011 11:50 PM

[SOLVED] How do I make Firefox run vlc with URL?
 
Quote:

Originally Posted by 16pide (Post 4376693)
The idea is that getting the xspf file takes under a second (a few lines of xml). Then vlc gets it from the browser, analyses it, finds a http url in it, and then plays that http url while downloading it.

I tried it (my post above), and could start viewing my video immediately which is what I think you're looking for.

if your version 1.0.6 of vlc does not work with that xspf standard, then upgrade to 1.1.9

Yes, I tried it and it works well enough. Not perfect, I'd still like to hand the URL to the program, but it works, it is quick as you say, and I don't think it will accumulate and bunch of crap in /tmp. So I will go with this method until I find the ideal solution.

Thanks much 16pide for the idea.

dugan 06-06-2011 12:24 AM

Firefox needs to have VLC registered as a protocol handler.

http://kb.mozillazine.org/Register_protocol

zzyxx 06-06-2011 11:35 PM

Quote:

Originally Posted by dugan (Post 4377449)
Firefox needs to have VLC registered as a protocol handler.

http://kb.mozillazine.org/Register_protocol

Thanks Dugan! That would be really great if it worked, but it doesn't.
Do I have to be running Gnome? I'm running XFCE but it runs Gnome compatibility libraries.

I did:
gconftool-2 -s /desktop/gnome/url-handlers/vlc/command '/usr/bin/vlc %s' --type String
gconftool-2 -s /desktop/gnome/url-handlers/foo/enabled --type Boolean true
then restarted Firefox and tried
vlc://192.168.0.45:8080/path-to-my-file
and it replied:
Firefox doesn't know how to open this address, because the protocol (vlc) isn't associated with any program.
I also tried Opera which did the same thing.

I wonder what it takes to make it work, but thanks for the tip.

ruario 06-07-2011 02:47 AM

In Opera go to "Preferences (Alt+p) > Advanced > Programs" and add vlc as a protocol.

zzyxx 06-07-2011 02:18 PM

Quote:

Originally Posted by zzyxx (Post 4378415)
Thanks Dugan! That would be really great if it worked, but it doesn't.
Do I have to be running Gnome? I'm running XFCE but it runs Gnome compatibility libraries.

I did:
gconftool-2 -s /desktop/gnome/url-handlers/vlc/command '/usr/bin/vlc %s' --type String
gconftool-2 -s /desktop/gnome/url-handlers/foo/enabled --type Boolean true
then restarted Firefox and tried
vlc://192.168.0.45:8080/path-to-my-file
and it replied:
Firefox doesn't know how to open this address, because the protocol (vlc) isn't associated with any program.
I also tried Opera which did the same thing.

I wonder what it takes to make it work, but thanks for the tip.

Oh I see an error above. I did not replace foo with vlc in second line. Let me try again...

zzyxx 06-07-2011 11:00 PM

Quote:

Originally Posted by zzyxx (Post 4379067)
Oh I see an error above. I did not replace foo with vlc in second line. Let me try again...

Thanks ruario, and thanks again dugan.

Both of these work now. The Opera setting works, and after I typed the gconftool correctly, that worked too for Firefox.
It now invokes vlc with the URL.

The only problem is, vlc doesn't know how to deal with a URL that starts with "vlc://..." so not sure what to do.
It won't let me invoke a bash script, which I can use to change the vlc to http, so I may have to write a little program.
But that's a whole different problem.
This mission is accomplished.

ruario 06-08-2011 01:37 AM

In that case U suspect the fix that dugan gave you would actually have been enough for Opera as well, since it passes off unknown protocols to the desktop environment but it doesn't hurt actually setting it within Opera. Also this would be the best way to do it for someone who ran Opera and a simple window manager, rather than a full desktop environment.

zzyxx 06-09-2011 12:18 AM

Quote:

Originally Posted by ruario (Post 4379506)
In that case U suspect the fix that dugan gave you would actually have been enough for Opera as well, since it passes off unknown protocols to the desktop environment but it doesn't hurt actually setting it within Opera. Also this would be the best way to do it for someone who ran Opera and a simple window manager, rather than a full desktop environment.

I will say that Opera was easier to set up.
Ultimately I also want this to work with Macbook, so probably the XSPF will be the way to go there.
It think it will be easier to set up for a given browser to tell it handle .xspf rather than a protocol.
I'm glad I learned both ways to do it.


All times are GMT -5. The time now is 04:24 AM.