Hi,

With the attached patches you will be able to play audio/video files
using the web-browser's VLC player plugin. When you click on a
video/audio item you have one more option called "Play file using VLC"
in addition to the usual "Play file" and "Close" options. Clicking on
"Play file using VLC" will attempt to load VLC plugin as an embedded
player (if one is installed for your browser) and plays the content.
You can pause, play, stop or go fullscreen with it. I mostly copied
code from VLC doc pages.

Let me know if this is useful, may be it can be polished to have
several items queued in the player playlist (for example lots of audio
files) and make it like a web player. I tested it on a windows machine
and it works fine. I am using mplayer plug-in in my linux machine
which works with "Play file" so did not bother testing it.

Thanks
Chandan
Index: src/www/htdocs/fileinfo.rpy
===================================================================
--- src/www/htdocs/fileinfo.rpy (revision 8926)
+++ src/www/htdocs/fileinfo.rpy (working copy)
@@ -55,7 +55,7 @@

         if file:
             medium = metadata.parse(file)
-            print medium
+            #print medium
             title = ""
             info = "<table>"
             (basedir, item) = os.path.split(file)
@@ -106,12 +106,27 @@
                u"doc.getElementById('file-head').innerHTML = '%s';\n"\
                u"doc.getElementById('file-info').innerHTML = '%s';\n"\
                u"doc.getElementById('file-play-button').onclick = %s;\n"\
+               u"doc.getElementById('file-play-using-vlc').onclick = %s;\n"\
                u"doc.getElementById('program-waiting').style.display = 
'none';\n" \
                u"doc.getElementById('program-info').style.visibility = 
'visible';\n" \
                u"</script>\n"
             ) % ( Unicode(title.replace("'", "\\'")),
                   Unicode(info.replace("'", "\\'")),
-                  "function() { window.open(\"%s\"); }" % (file_link),
+                  "function() { window.open(\"%s\"); }" % (file_link),
+                  '\
+                  function() { \
+                      vlc_window = window.open(""); \
+                      vlc_window.document.write(\'<html><head><title>VLC 
Player</title></head><body>\'); \
+                      vlc_window.document.write(\'<embed 
type="application/x-vlc-plugin" name="video" autoplay="yes" \'); \
+                      vlc_window.document.write(\'width="640" height="480" 
target="http://\'); \
+                      vlc_window.document.write(location.hostname + \':\' + 
location.port + \'/' + urllib.quote(file_link) + '"/><br/>\'); \
+                      vlc_window.document.write(\'<a href="javascript:;" 
onclick="document.video.play()">Play</a>&nbsp\'); \
+                      vlc_window.document.write(\'<a href="javascript:;" 
onclick="document.video.pause()">Pause</a>&nbsp\'); \
+                      vlc_window.document.write(\'<a href="javascript:;" 
onclick="document.video.stop()">Stop</a>&nbsp\'); \
+                      vlc_window.document.write(\'<a href="javascript:;" 
onclick="document.video.fullscreen()">Fullscreen</a>\'); \
+                      vlc_window.document.write(\'</body></html>\'); \
+                  }\
+                  '
             )

         elif img:

Index: src/www/htdocs/library.rpy
===================================================================
--- src/www/htdocs/library.rpy  (revision 8926)
+++ src/www/htdocs/library.rpy  (working copy)
@@ -577,6 +577,10 @@
             u"                        <td id=\"file-play-button\">\n"\
             u"                           "+_('Play file')+u"\n"\
             u"                        </td>\n"\
+            u"                        <td id=\"file-play-using-vlc\">\n"\
+            u"                        "+_('Play file using VLC')+u"\n"\
+            u"                        "+''+u"\n"\
+            u"                        </td>\n"\
             u"                        <td id=\"program-favorites-button\">\n"\
             #u"                        "+_('Play file on Freevo')+u"\n"\
             u"                        "+''+u"\n"\

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to