[vlc-devel] vlc plugin and attachment:// URIs

Michael A. Puls II shadow2531 at gmail.com
Mon Jul 20 03:47:54 CEST 2009


In Opera's built-in mail client, when you right-click on an attachment and  
choose open, Opera loads a new tab with the attachment in it.

So, if you open the attachment foo.jpg, attachment:/278/foo.jpg will load  
in the new tab and you'll see the pic.

The source (via document.documentElement.outerHTML) of the attachment page  
will be something like:

<HTML><HEAD><LINK rel="stylesheet" media="screen,projection,tv,handheld"  
href="opera:style/image.css"></HEAD><BODY><DIV><IMG  
src=""></DIV></BODY></HTML>

for example. (the src value is handled internally).

Now, if you have the vlc plugin installed and set it to handle ogg files  
in Opera and open an .ogg attachment, you'll get a new tab with  
attachment:/789/file.ogg in the address field and since it ends in .ogg,  
the vlc plugin will load.

The source of this page will be something like:

<HTML><HEAD><META name="viewport"  
content="width=device-width"></HEAD><BODY style="margin: 0;"><EMBED src=""  
width="100%" height="100%"></BODY></HTML>

for example. (The src attribute value is handled internally, where the src  
param will be "attachment:/789/file.ogg")

The problem is that the vlc plugin won't play the .ogg file in this case  
because it can't find it. The plug-in doesn't know what to do with  
attachment:/789/file.ogg.

In this situation, the plugin should use NP functions to request the file  
 from Opera so Opera can stream it to the plugin, which is what Flash does  
with attachment:/321/file.swf.

However, the vlc plugin, even in normal conditions where  
document.location.href and the src param are values that it understands,  
never seems to request the file from the browser and seems to always  
download the file with its own network code. (This probably also explains  
why if you use <object type="application/x-vlc-plugin" data="file.ogg">,  
the plug-in never tries to stream the file the browser is already  
downloading)

I don't know how to do it exactly how flash does it, but the plug-in  
should do something like this:

If document.location.href starts with "attachment:", ask the browser to  
stream the file to the plug-in.

-- 
Michael



More information about the vlc-devel mailing list