Passing an address from a browser to a program

Hi, there,

Anybody knows how to pass an address from a web browser to a program by clicking on the link? This is intended to handle streaming videos. For example: on a website, I have a link to the address "http://(something).avi", is it possible to click on the link using mouse to invoke mplayer (no plugins, please), without downloading the file? Let's say I am working with Firefox or Opera. I actually would like to manipulate the URL (by using a shell script) after clicking as well, if that's possible.

Thanks!
 
Without plugins, the only way to invoke a player is using the new-ish HTML5 element 'video' which will use the built-in player for that browser. However, browser vendors have not settled on just one video format so you will most likely have to serve two if you want to cover all browsers. But this is not a comprehensive method. Not all video formats will play.
 
shuxuef said:
Anybody knows how to pass an address from a web browser to a program by clicking on the link?
[snip]
to invoke mplayer (no plugins, please), without downloading the file?
[snip]
I actually would like to manipulate the URL (by using a shell script) after clicking as well, if that's possible.
Most browsers have adjustable file handlers, which means that somewhere in the settings you can tell the browser what to do with certain files. If you're using Opera (something similar can probably be done with Firefox), the following should work (tested, works for me):
  • Write the script to manipulate the URL and feed it to mplayer, for example something like this:
    Code:
    #!/bin/sh
    
    echo $1 >> /home/fonz/littlelogfile
    
    /usr/local/bin/mplayer $1 &
    (this is a very simple and stupid script, but you probably get the idea)
  • Go to Tools -> Preferences -> Advanced -> Downloads
  • For every MIME type you wish to support, add or edit an entry. Select "open with other application", fill in the path to your script and check the "pass web address directly to application" box.
  • Hint: if you're not sure about the MIME types, you can find out by clicking on the link, choosing an application from the dialog list, checking "remember choice", interrupting the download, searching the handler list (the "Go to..." step above) for the right entry and editing that.
Hope this helps,

Fonz
 
Both methods mentioned by Chalkbored and fonz, which I tried before, requires downloading the file first. My original question was asking for a non-downloading method, just passing the address (i.e. the browser should only pass the address of that file the the application, without doing anything else to that file). Is it possible? Thanks!
 
Without a plugin or something alike, this is highly unprobably going to be easy: Most online video links are encoded in some way and require evaluation by some (java)script. A Browser will do this on-demand, but then it will do it's default action on that uri, which is either writing to disk, or running the file by first writing the data to disk and then handing the path to some application - which is the least troublesome solution as most file viewers cannot handle anything other then local files.

Also, the object element of html can be used to embed videos on webpages in a typesafe manner - in fact it could be used for that purpose even before adobe flash even existed ;)
 
shuxuef said:
Both methods mentioned by Chalkbored and fonz, which I tried before, requires downloading the file first.
As I mentioned, Opera has the option "pass web address directly to the application". I checked that. Without it, Opera will indeed first download the entire file before actually handling it. But with that option checked it does what it says: it passes the URL to the application (or shell script) without downloading it first. Believe me, I tried. I can simply click on a link to an AVI file and Opera sends the URL to the script (without any dialogs), which in turn writes the URL to a file (which is what my test script does, you'll want to do something else) and sends the URL to mplayer.

Fonz

Note to add: it is essential that you get the MIME type(s) right. Otherwise, you'll just get the download dialog.

Hint: the MIME type I had to use is video/x-msvideo but that might (or not) depend on the server.
 
drhowarddrfine said:
Without plugins, the only way to invoke a player is using the new-ish HTML5 element 'video'
That's server side, I think the OP is talking client side.

Fonz
 
fonz said:
As I mentioned, Opera has the option "pass web address directly to the application". I checked that. Without it, Opera will indeed first download the entire file before actually handling it. But with that option checked it does what it says: it passes the URL to the application (or shell script) without downloading it first. Believe me, I tried. I can simply click on a link to an AVI file and Opera sends the URL to the script (without any dialogs), which in turn writes the URL to a file (which is what my test script does, you'll want to do something else) and sends the URL to mplayer.

Fonz

Note to add: it is essential that you get the MIME type(s) right. Otherwise, you'll just get the download dialog.

Hint: the MIME type I had to use is video/x-msvideo but that might (or not) depend on the server.



Ah, indeed you were right. I did not used the correct MIME type. By the way, for me Opera would pop up a blank tab before invoke the script. Is it possible make it not do that?

Thanks a lot!
 
fonz said:
That's server side, I think the OP is talking client side.
He says he wants to have streaming video to do something like invoking mplayer. I don't think he wants to run mplayer on the server when he clicks a link in the browser. I also don't think he's wanting to invoke any program on the server but wants it to run on his system and, specifically, in the browser. If I'm wrong, I need clarification.

Specifically, I think he's saying he wants to watch video in the browser when he clicks on a link and I'll repeat, that won't happen if he doesn't want to use plug-ins or download the video.
 
drhowarddrfine said:
Specifically, I think he's saying he wants to watch video in the browser when he clicks on a link and I'll repeat, that won't happen if he doesn't want to use plug-ins or download the video.

Otherwise is a browser lack of security. For that reason browsers shouldn't run external programs without an explicit user permission: plugins or system components and specific browser options).
 
drhowarddrfine said:
I don't think he wants to run mplayer on the server
Indeed.
drhowarddrfine said:
I also don't think he's wanting to invoke any program on the server but wants it to run on his system
Indeed.
drhowarddrfine said:
and, specifically, in the browser.
[snip]
I think he's saying he wants to watch video in the browser when he clicks on a link
No, not in the browser. That's the whole point. He wants the browser to pass the URL to an external program (in this case a script that manipulates the URL and then launches mplayer, but theoretically it could be anything). And he wants the browser to just pass the URL without insisting on downloading the entire file first.

Fonz
 
Very sorry for the confusion, guys. fonz has been always right about what I was asking for. In terms of Opera, what he said in the last post can be done, although I don't know about Firefox (I tried but failed). Thanks!
 
Back
Top