vlc working + media
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@690 2a923420-c742-0410-a762-8d5b09965624
@ -33,6 +33,14 @@ if {$order eq "-"} {
|
||||
set model [system model]
|
||||
set dustbin [system dustbin 1]
|
||||
|
||||
proc icon {img {hover ""} {extra ""}} {
|
||||
puts -nonewline "<img src=$img class=va height=21 $extra"
|
||||
if {$hover ne ""} {
|
||||
puts -nonewline " alt=\"$hover\" title=\"$hover\""
|
||||
}
|
||||
puts ">"
|
||||
}
|
||||
|
||||
proc directory {file bfile} {
|
||||
global flatten
|
||||
|
||||
@ -51,14 +59,8 @@ proc directory {file bfile} {
|
||||
set noflat 0
|
||||
if $flatten {
|
||||
if {[string match {\[*\]} [file tail $file]]} { set noflat 1 }
|
||||
if {[file exists "$file/.noflatten"]} {
|
||||
set noflat 1
|
||||
}
|
||||
|
||||
if $noflat {
|
||||
puts "<img alt=\"No-flatten\" title=\"No-flatten\"
|
||||
class=va src=/img/flat-tyre.png height=21>"
|
||||
}
|
||||
if {[file exists "$file/.noflatten"]} { set noflat 1 }
|
||||
if $noflat { icon "/img/flat-tyre.png" "No-flatten" }
|
||||
}
|
||||
|
||||
puts -nonewline "
|
||||
@ -155,39 +157,32 @@ proc entry {file} {{i 0}} {
|
||||
set def SD
|
||||
set img "172_1_26_SD"
|
||||
}
|
||||
puts "<img class=va src=/images/$img.png height=21>"
|
||||
icon "/images/$img.png"
|
||||
|
||||
# Locked
|
||||
if {[$ts flag "Locked"] > 0} {
|
||||
set locked 1
|
||||
puts "<img class=va src=/images/178_1_00_Icon_Lock.png
|
||||
height=21>"
|
||||
icon "/images/178_1_00_Icon_Lock.png" "Locked"
|
||||
}
|
||||
|
||||
# Encrypted
|
||||
if {[$ts flag "Encrypted"] > 0} {
|
||||
set encd 1
|
||||
puts "<img class=va
|
||||
src=/images/749_1_26_Video_Encryption.png
|
||||
height=21>"
|
||||
icon "/images/749_1_26_Video_Encryption.png" ""
|
||||
}
|
||||
if {![$ts flag "ODEncrypted"]} {
|
||||
puts "<img class=va src=/img/Decrypted.png height=21>"
|
||||
set odencd 0
|
||||
icon "/img/Decrypted.png" "Decrypted"
|
||||
}
|
||||
|
||||
# Guidance
|
||||
if {[$ts flag "Guidance"] > 0} {
|
||||
puts "<img class=va
|
||||
src=/images/174_1_26_GuidancePolicy.png
|
||||
height=21>"
|
||||
icon "/images/174_1_26_GuidancePolicy.png"
|
||||
}
|
||||
|
||||
# Indexed
|
||||
if {$::model eq "HDR" && [llength [$ts dlnaloc]]} {
|
||||
puts "<img class=va src=/img/dlna.png
|
||||
title=\"Indexed by DLNA Server\"
|
||||
alt=\"Indexed by DLNA Server\" height=21>"
|
||||
icon "/img/dlna.png" "Indexed by DLNA Server"
|
||||
set dlna 1
|
||||
}
|
||||
|
||||
|
@ -436,6 +436,13 @@ var dmenuclick = function(action, el, pos)
|
||||
// Disable items which are not yet implemented.
|
||||
$('#optmenu').disableContextMenuItems('#title');
|
||||
|
||||
var $buttons = {
|
||||
"Close" : function() {$(this).dialog('close');}
|
||||
};
|
||||
var $buttonsp = $.extend(
|
||||
{"Play" : function() { doplay(); }},
|
||||
$buttons);
|
||||
|
||||
// Create reusable dialogue.
|
||||
var $dialog = $('#dialogue').dialog({
|
||||
title: "Media Details",
|
||||
@ -443,23 +450,43 @@ var dmenuclick = function(action, el, pos)
|
||||
height: 600, width: 700,
|
||||
show: 'scale', hide: 'fade',
|
||||
draggable: true, resizable: true,
|
||||
buttons: {
|
||||
"Close": function() {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
},
|
||||
buttons: $buttons,
|
||||
close: function(e,u) { $('#dialogue').empty().html(
|
||||
'<img src="/img/loading.gif" alt="loading">'); }
|
||||
});
|
||||
|
||||
function doplay()
|
||||
{
|
||||
var file = $dialog.attr('file');
|
||||
var type = $dialog.attr('type');
|
||||
|
||||
disableall();
|
||||
|
||||
window.location = '/cgi-bin/browse/play.jim?' +
|
||||
'dir=' + encodeURIComponent(dir) +
|
||||
'&file=' + file;
|
||||
}
|
||||
|
||||
// Bind dialogue open to filenames.
|
||||
$('a.bf').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var file = $(this).attr('file');
|
||||
var type = $(this).attr('type');
|
||||
var opt = $(this).nextAll('a').find('img.opt');
|
||||
|
||||
var url = '/cgi-bin/browse/file.jim?file=' + file
|
||||
+ '&type=' + type;
|
||||
$('#dialogue').load(url);
|
||||
$dialog.load(url);
|
||||
|
||||
$dialog.attr('file', file);
|
||||
$dialog.attr('type', type);
|
||||
|
||||
if (type == 'ts' &&
|
||||
(opt.attr('odencd') == 0 || opt.attr('dlna') == 1))
|
||||
$dialog.dialog("option", "buttons", $buttonsp);
|
||||
else
|
||||
$dialog.dialog("option", "buttons", $buttons);
|
||||
$dialog.dialog('open');
|
||||
});
|
||||
|
||||
|
@ -10,6 +10,7 @@ cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set dir [cgi_get dir]
|
||||
regsub -all {([\\["$])} $dir {\\\1} dir
|
||||
|
||||
#puts "DIR: ($dir)"
|
||||
|
||||
@ -33,15 +34,17 @@ proc touch {file} {
|
||||
|
||||
puts "<div id=deleting class=blood><img src=/img/loading.gif>Deleting...</div>"
|
||||
puts "<ul style=\"list-style-type: square\">"
|
||||
|
||||
foreach file [cgi_get files] {
|
||||
|
||||
puts -nonewline "<li>\"$file\"..."
|
||||
regsub -all {([\\["$])} $dir {\\\1} dir
|
||||
|
||||
if {![string match "$dir/*" $file]} {
|
||||
puts "Error - outside directory."
|
||||
continue
|
||||
}
|
||||
|
||||
if {[string first $dustbin $file] > -1} {
|
||||
if {$dustbin ne "" && [string first $dustbin $file] > -1} {
|
||||
set ldustbin ""
|
||||
} else {
|
||||
set ldustbin $dustbin
|
||||
|
@ -18,15 +18,34 @@ if {[catch {$ts get file}]} {
|
||||
exit
|
||||
}
|
||||
|
||||
if {![$ts flag "ODEncrypted"]} {
|
||||
set url $rfile
|
||||
} else {
|
||||
lassign [$ts dlnaloc] url
|
||||
if {$url eq ""} {
|
||||
alert("Media is encrypted and not indexed by the DLNA Server.");
|
||||
}
|
||||
}
|
||||
|
||||
puts "
|
||||
<span id=url style=\"display: none\">$url</span>
|
||||
"
|
||||
|
||||
puts {
|
||||
<script type="text/javascript" src="play.js"></script>
|
||||
<script language="javascript" src="/js/jquery-vlc.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/css/vlc.css" />
|
||||
<script type=text/javascript src=play.js></script>
|
||||
|
||||
<fieldset class=cleft style="margin: 0 1em 1em 1em">
|
||||
<legend>VLC Player</legend>
|
||||
<div>
|
||||
}
|
||||
puts "Now playing: $rfile, [$ts duration] minutes."
|
||||
puts "<span class=also>Now playing: $rfile, [$ts duration] minutes.</span>"
|
||||
puts {
|
||||
<div id=vlc></div>
|
||||
|
||||
<div class=also id=info style="float: right">
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
}
|
||||
|
||||
|
13
var/mongoose/cgi-bin/browse/play.js
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var url = $('#url').text();
|
||||
|
||||
var vlc = VLCobject.embedPlayer('vlc', 800, 450, true);
|
||||
vlc.play(encodeURI(url));
|
||||
|
||||
if (window.console)
|
||||
console.log("Playing: %o", url);
|
||||
|
||||
});
|
||||
|
@ -315,7 +315,7 @@ div.cut
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
font.also
|
||||
.also
|
||||
{
|
||||
font-size: 0.9em;
|
||||
font-style: italic;
|
||||
|
60
var/mongoose/html/css/vlc.css
Normal file
@ -0,0 +1,60 @@
|
||||
.x-vlc-slider {
|
||||
background:#C7F2FF;
|
||||
text-align:center;
|
||||
|
||||
}
|
||||
.x-vlc-slider-thumb {
|
||||
background:#4EAECC;
|
||||
width:3px;
|
||||
}
|
||||
.x-vlc-main {
|
||||
|
||||
}
|
||||
.x-vlc-toolbar {
|
||||
|
||||
color:black;
|
||||
|
||||
}
|
||||
.x-vlc-toolbar * {
|
||||
vertical-align:top;
|
||||
|
||||
}
|
||||
.x-vlc-btn {
|
||||
|
||||
padding-right:10px;
|
||||
|
||||
|
||||
}
|
||||
.x-vlc-btn-fullscreen {
|
||||
background:url(images/fullscreen2.gif) no-repeat;
|
||||
}
|
||||
.x-vlc-btn-plus {
|
||||
background:url(images/plus2.gif) no-repeat;
|
||||
}
|
||||
.x-vlc-btn-moins {
|
||||
background:url(images/moins2.gif) no-repeat;
|
||||
}
|
||||
.x-vlc-btn:hover {
|
||||
color:red;
|
||||
|
||||
}
|
||||
.x-vlc-btn-play {
|
||||
background:url(images/play2.gif) no-repeat;
|
||||
}
|
||||
.x-vlc-btn-stop {
|
||||
background:url(images/stop2.gif) no-repeat;
|
||||
|
||||
}
|
||||
.x-vlc-btn-pause {
|
||||
background:url(images/pause2.gif) no-repeat;
|
||||
|
||||
}
|
||||
.x-vlc-timer {
|
||||
width:100px;
|
||||
font-size:12px;
|
||||
vertical-align:top;
|
||||
text-align:center
|
||||
}
|
||||
.x-vlc-about {
|
||||
font-size:10px;
|
||||
}
|
BIN
var/mongoose/html/img/media/fast_backward.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
var/mongoose/html/img/media/fast_forward.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
var/mongoose/html/img/media/move.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
var/mongoose/html/img/media/mute_2.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
var/mongoose/html/img/media/next_track.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
var/mongoose/html/img/media/pause.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
var/mongoose/html/img/media/play.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
var/mongoose/html/img/media/previous_track.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
var/mongoose/html/img/media/scroll_left.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
var/mongoose/html/img/media/scroll_right.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
var/mongoose/html/img/media/stop.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
var/mongoose/html/img/media/volume_2.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
var/mongoose/html/img/quicktime.gif
Normal file
After Width: | Height: | Size: 1.4 KiB |
364
var/mongoose/html/js/ac_quicktime.js
Normal file
@ -0,0 +1,364 @@
|
||||
/*
|
||||
|
||||
File: AC_QuickTime.js
|
||||
|
||||
Abstract: This file contains functions to generate OBJECT and EMBED tags for QuickTime content.
|
||||
|
||||
Version: <1.2.1>
|
||||
|
||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Computer, Inc. ("Apple") in consideration of your agreement to the
|
||||
following terms, and your use, installation, modification or
|
||||
redistribution of this Apple software constitutes acceptance of these
|
||||
terms. If you do not agree with these terms, please do not use,
|
||||
install, modify or redistribute this Apple software.
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
||||
Software, with or without modifications, in source and/or binary forms;
|
||||
provided that if you redistribute the Apple Software in its entirety and
|
||||
without modifications, you must retain this notice and the following
|
||||
text and disclaimers in all such redistributions of the Apple Software.
|
||||
Neither the name, trademarks, service marks or logos of Apple Computer,
|
||||
Inc. may be used to endorse or promote products derived from the Apple
|
||||
Software without specific prior written permission from Apple. Except
|
||||
as expressly stated in this notice, no other rights or licenses, express
|
||||
or implied, are granted by Apple herein, including but not limited to
|
||||
any patent rights that may be infringed by your derivative works or by
|
||||
other works in which the Apple Software may be incorporated.
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
|
||||
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
|
||||
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
||||
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Copyright © 2006-2007 Apple Computer, Inc., All Rights Reserved
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains functions to generate OBJECT and EMBED tags for QuickTime content.
|
||||
*/
|
||||
|
||||
/************** LOCALIZABLE GLOBAL VARIABLES ****************/
|
||||
|
||||
var gArgCountErr = 'The "%%" function requires an even number of arguments.'
|
||||
+ '\nArguments should be in the form "atttributeName", "attributeValue", ...';
|
||||
|
||||
/******************** END LOCALIZABLE **********************/
|
||||
|
||||
var gTagAttrs = null;
|
||||
var gQTGeneratorVersion = 1.2;
|
||||
var gQTBehaviorID = "qt_event_source";
|
||||
var gQTEventsEnabled = false;
|
||||
|
||||
function AC_QuickTimeVersion() { return gQTGeneratorVersion; }
|
||||
|
||||
function _QTComplain(callingFcnName, errMsg)
|
||||
{
|
||||
errMsg = errMsg.replace("%%", callingFcnName);
|
||||
alert(errMsg);
|
||||
}
|
||||
|
||||
function _QTIsMSIE()
|
||||
{
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
var msie = /msie/.test(ua) && !/opera/.test(ua);
|
||||
|
||||
return msie;
|
||||
}
|
||||
|
||||
|
||||
function _QTGenerateBehavior()
|
||||
{
|
||||
return objTag = '<!--[if IE]>'
|
||||
+ '<object id="' + gQTBehaviorID + '" classid="clsid:CB927D12-4FF7-4a9e-A169-56E4B8A75598"></object>'
|
||||
+ '<![endif]-->';
|
||||
}
|
||||
|
||||
function _QTPageHasBehaviorObject(callingFcnName, args)
|
||||
{
|
||||
var haveBehavior = false;
|
||||
var objects = document.getElementsByTagName('object');
|
||||
|
||||
for ( var ndx = 0, obj; obj = objects[ndx]; ndx++ )
|
||||
{
|
||||
if ( obj.getAttribute('classid') == "clsid:CB927D12-4FF7-4a9e-A169-56E4B8A75598" )
|
||||
{
|
||||
if ( obj.getAttribute('id') == gQTBehaviorID )
|
||||
haveBehavior = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return haveBehavior;
|
||||
}
|
||||
|
||||
|
||||
function _QTShouldInsertBehavior()
|
||||
{
|
||||
var shouldDo = false;
|
||||
|
||||
if ( gQTEventsEnabled && _QTIsMSIE() && !_QTPageHasBehaviorObject() )
|
||||
shouldDo = true;
|
||||
|
||||
return shouldDo;
|
||||
}
|
||||
|
||||
|
||||
function _QTAddAttribute(prefix, slotName, tagName)
|
||||
{
|
||||
var value;
|
||||
|
||||
value = gTagAttrs[prefix + slotName];
|
||||
if ( null == value )
|
||||
value = gTagAttrs[slotName];
|
||||
|
||||
if ( null != value )
|
||||
{
|
||||
if ( 0 == slotName.indexOf(prefix) && (null == tagName) )
|
||||
tagName = slotName.substring(prefix.length);
|
||||
if ( null == tagName )
|
||||
tagName = slotName;
|
||||
return ' ' + tagName + '="' + value + '"';
|
||||
}
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
function _QTAddObjectAttr(slotName, tagName)
|
||||
{
|
||||
// don't bother if it is only for the embed tag
|
||||
if ( 0 == slotName.indexOf("emb#") )
|
||||
return "";
|
||||
|
||||
if ( 0 == slotName.indexOf("obj#") && (null == tagName) )
|
||||
tagName = slotName.substring(4);
|
||||
|
||||
return _QTAddAttribute("obj#", slotName, tagName);
|
||||
}
|
||||
|
||||
function _QTAddEmbedAttr(slotName, tagName)
|
||||
{
|
||||
// don't bother if it is only for the object tag
|
||||
if ( 0 == slotName.indexOf("obj#") )
|
||||
return "";
|
||||
|
||||
if ( 0 == slotName.indexOf("emb#") && (null == tagName) )
|
||||
tagName = slotName.substring(4);
|
||||
|
||||
return _QTAddAttribute("emb#", slotName, tagName);
|
||||
}
|
||||
|
||||
|
||||
function _QTAddObjectParam(slotName, generateXHTML)
|
||||
{
|
||||
var paramValue;
|
||||
var paramStr = "";
|
||||
var endTagChar = (generateXHTML) ? ' />' : '>';
|
||||
|
||||
if ( -1 == slotName.indexOf("emb#") )
|
||||
{
|
||||
// look for the OBJECT-only param first. if there is none, look for a generic one
|
||||
paramValue = gTagAttrs["obj#" + slotName];
|
||||
if ( null == paramValue )
|
||||
paramValue = gTagAttrs[slotName];
|
||||
|
||||
if ( 0 == slotName.indexOf("obj#") )
|
||||
slotName = slotName.substring(4);
|
||||
|
||||
if ( null != paramValue )
|
||||
paramStr = '<param name="' + slotName + '" value="' + paramValue + '"' + endTagChar;
|
||||
}
|
||||
|
||||
return paramStr;
|
||||
}
|
||||
|
||||
function _QTDeleteTagAttrs()
|
||||
{
|
||||
for ( var ndx = 0; ndx < arguments.length; ndx++ )
|
||||
{
|
||||
var attrName = arguments[ndx];
|
||||
delete gTagAttrs[attrName];
|
||||
delete gTagAttrs["emb#" + attrName];
|
||||
delete gTagAttrs["obj#" + attrName];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// generate an embed and object tag, return as a string
|
||||
function _QTGenerate(callingFcnName, generateXHTML, args)
|
||||
{
|
||||
// is the number of optional arguments even?
|
||||
if ( args.length < 4 || (0 != (args.length % 2)) )
|
||||
{
|
||||
_QTComplain(callingFcnName, gArgCountErr);
|
||||
return "";
|
||||
}
|
||||
|
||||
// allocate an array, fill in the required attributes with fixed place params and defaults
|
||||
gTagAttrs = new Object();
|
||||
gTagAttrs["src"] = args[0];
|
||||
gTagAttrs["width"] = args[1];
|
||||
gTagAttrs["height"] = args[2];
|
||||
gTagAttrs["type"] = "video/quicktime";
|
||||
gTagAttrs["classid"] = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
|
||||
//Impportant note: It is recommended that you use this exact classid in order to ensure a seamless experience for all viewers
|
||||
gTagAttrs["pluginspage"] = "http://www.apple.com/quicktime/download/";
|
||||
|
||||
// set up codebase attribute with specified or default version before parsing args so
|
||||
// anything passed in will override
|
||||
var activexVers = args[3]
|
||||
if ( (null == activexVers) || ("" == activexVers) )
|
||||
activexVers = "7,3,0,0";
|
||||
gTagAttrs["codebase"] = "http://www.apple.com/qtactivex/qtplugin.cab#version=" + activexVers;
|
||||
|
||||
var attrName,
|
||||
attrValue;
|
||||
|
||||
// add all of the optional attributes to the array
|
||||
for ( var ndx = 4; ndx < args.length; ndx += 2)
|
||||
{
|
||||
attrName = args[ndx].toLowerCase();
|
||||
attrValue = args[ndx + 1];
|
||||
|
||||
gTagAttrs[attrName] = attrValue;
|
||||
|
||||
if ( ("postdomevents" == attrName) && (attrValue.toLowerCase() != "false") )
|
||||
{
|
||||
gQTEventsEnabled = true;
|
||||
if ( _QTIsMSIE() )
|
||||
gTagAttrs["obj#style"] = "behavior:url(#" + gQTBehaviorID + ")";
|
||||
}
|
||||
}
|
||||
|
||||
// init both tags with the required and "special" attributes
|
||||
var objTag = '<object '
|
||||
+ _QTAddObjectAttr("classid")
|
||||
+ _QTAddObjectAttr("width")
|
||||
+ _QTAddObjectAttr("height")
|
||||
+ _QTAddObjectAttr("codebase")
|
||||
+ _QTAddObjectAttr("name")
|
||||
+ _QTAddObjectAttr("id")
|
||||
+ _QTAddObjectAttr("tabindex")
|
||||
+ _QTAddObjectAttr("hspace")
|
||||
+ _QTAddObjectAttr("vspace")
|
||||
+ _QTAddObjectAttr("border")
|
||||
+ _QTAddObjectAttr("align")
|
||||
+ _QTAddObjectAttr("class")
|
||||
+ _QTAddObjectAttr("title")
|
||||
+ _QTAddObjectAttr("accesskey")
|
||||
+ _QTAddObjectAttr("noexternaldata")
|
||||
+ _QTAddObjectAttr("obj#style")
|
||||
+ '>'
|
||||
+ _QTAddObjectParam("src", generateXHTML);
|
||||
var embedTag = '<embed '
|
||||
+ _QTAddEmbedAttr("type")
|
||||
+ _QTAddEmbedAttr("src")
|
||||
+ _QTAddEmbedAttr("width")
|
||||
+ _QTAddEmbedAttr("height")
|
||||
+ _QTAddEmbedAttr("pluginspage")
|
||||
+ _QTAddEmbedAttr("name")
|
||||
+ _QTAddEmbedAttr("id")
|
||||
+ _QTAddEmbedAttr("align")
|
||||
+ _QTAddEmbedAttr("tabindex");
|
||||
|
||||
// delete the attributes/params we have already added
|
||||
_QTDeleteTagAttrs("type","src","width","height","pluginspage","classid","codebase","name","tabindex",
|
||||
"hspace","vspace","border","align","noexternaldata","class","title","accesskey","id","style");
|
||||
|
||||
// and finally, add all of the remaining attributes to the embed and object
|
||||
for ( var attrName in gTagAttrs )
|
||||
{
|
||||
attrValue = gTagAttrs[attrName];
|
||||
if ( null != attrValue )
|
||||
{
|
||||
embedTag += _QTAddEmbedAttr(attrName);
|
||||
objTag += _QTAddObjectParam(attrName, generateXHTML);
|
||||
}
|
||||
}
|
||||
|
||||
// end both tags, we're done
|
||||
return objTag + embedTag + '></em' + 'bed></ob' + 'ject' + '>';
|
||||
}
|
||||
|
||||
|
||||
// return the object/embed as a string
|
||||
function QT_GenerateOBJECTText()
|
||||
{
|
||||
var txt = _QTGenerate("QT_GenerateOBJECTText", false, arguments);
|
||||
if ( _QTShouldInsertBehavior() )
|
||||
txt = _QTGenerateBehavior() + txt;
|
||||
return txt;
|
||||
}
|
||||
|
||||
function QT_GenerateOBJECTText_XHTML()
|
||||
{
|
||||
var txt = _QTGenerate("QT_GenerateOBJECTText_XHTML", true, arguments);
|
||||
if ( _QTShouldInsertBehavior() )
|
||||
txt = _QTGenerateBehavior() + txt;
|
||||
return txt;
|
||||
}
|
||||
|
||||
function QT_WriteOBJECT()
|
||||
{
|
||||
var txt = _QTGenerate("QT_WriteOBJECT", false, arguments);
|
||||
if ( _QTShouldInsertBehavior() )
|
||||
document.writeln(_QTGenerateBehavior());
|
||||
document.writeln(txt);
|
||||
}
|
||||
|
||||
function QT_WriteOBJECT_XHTML()
|
||||
{
|
||||
var txt = _QTGenerate("QT_WriteOBJECT_XHTML", true, arguments);
|
||||
if ( _QTShouldInsertBehavior() )
|
||||
document.writeln(_QTGenerateBehavior());
|
||||
document.writeln(txt);
|
||||
}
|
||||
|
||||
function QT_GenerateBehaviorOBJECT()
|
||||
{
|
||||
return _QTGenerateBehavior();
|
||||
}
|
||||
|
||||
function QT_ReplaceElementContents()
|
||||
{
|
||||
var element = arguments[0];
|
||||
var args = [];
|
||||
|
||||
// copy all other arguments we want to pass through to the fcn
|
||||
for ( var ndx = 1; ndx < arguments.length; ndx++ )
|
||||
args.push(arguments[ndx]);
|
||||
|
||||
var txt = _QTGenerate("QT_ReplaceElementContents", false, args);
|
||||
if ( txt.length > 0 )
|
||||
element.innerHTML = txt;
|
||||
}
|
||||
|
||||
|
||||
function QT_ReplaceElementContents_XHTML()
|
||||
{
|
||||
var element = arguments[0];
|
||||
var args = [];
|
||||
|
||||
// copy all other arguments we want to pass through to the fcn
|
||||
for ( var ndx = 1; ndx < arguments.length; ndx++ )
|
||||
args.push(arguments[ndx]);
|
||||
|
||||
var txt = _QTGenerate("QT_ReplaceElementContents_XHTML", true, args);
|
||||
if ( txt.length > 0 )
|
||||
element.innerHTML = txt;
|
||||
}
|
||||
|
648
var/mongoose/html/js/jquery-vlc.js
vendored
Normal file
@ -0,0 +1,648 @@
|
||||
/*
|
||||
<OWNER> = revolunet
|
||||
<ORGANIZATION> = revolunet - Julien Bouquillon
|
||||
<YEAR> = 2010
|
||||
|
||||
Copyright (c) 2010, revolunet
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met :
|
||||
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE, DATA, OR PROFITS ; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var VLCobject = {
|
||||
VLC_PLUGIN:"VLC Multimedia Plug-in"
|
||||
,VLC_AX:"VideoLAN.VLCPlugin.2"
|
||||
,VLC_MIME_TYPE:"application/x-vlc-plugin"
|
||||
,TOOLBAR_HEIGHT:10
|
||||
,INSTANCES:{} // holds multiples instances
|
||||
,UNICODES:{
|
||||
PLAY:'\u25ba'
|
||||
,PAUSE:'\u2590 \u258c'
|
||||
,STOP:'\u2588'
|
||||
}
|
||||
,ua:function() {
|
||||
// browser detection stuff
|
||||
var w3cdom = typeof document.getElementById != 'undefined' && typeof document.getElementsByTagName != 'undefined' && typeof document.createElement != 'undefined',
|
||||
u = navigator.userAgent.toLowerCase(),
|
||||
p = navigator.platform.toLowerCase(),
|
||||
windows = p ? /win/.test(p) : /win/.test(u),
|
||||
mac = p ? /mac/.test(p) : /mac/.test(u),
|
||||
webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
|
||||
ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
|
||||
playerVersion = [0,0,0],
|
||||
d = null;
|
||||
if (typeof navigator.plugins != 'undefined' && typeof navigator.plugins[this.VLC_PLUGIN] == 'object') {
|
||||
d = navigator.plugins[this.VLC_PLUGIN].description;
|
||||
if (d && !(typeof navigator.mimeTypes != 'undefined' && navigator.mimeTypes[this.VLC_MIME_TYPE] && !navigator.mimeTypes[this.VLC_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes[VLC_MIME_TYPE].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
|
||||
plugin = true;
|
||||
ie = false; // cascaded feature detection for Internet Explorer
|
||||
d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
|
||||
playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
|
||||
playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
|
||||
playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
|
||||
}
|
||||
}
|
||||
else if (typeof window.ActiveXObject != 'undefined') {
|
||||
try {
|
||||
var a = new ActiveXObject(this.VLC_AX);
|
||||
if (a) { // a will return null when ActiveX is disabled
|
||||
d = a.GetVariable("$version");
|
||||
if (d) {
|
||||
ie = true; // cascaded feature detection for Internet Explorer
|
||||
d = d.split(" ")[1].split(",");
|
||||
playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(e) {}
|
||||
}
|
||||
return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
|
||||
}()
|
||||
|
||||
,createVLC:function(attObj, parObj, id) {
|
||||
var r, el = document.getElementById(id);
|
||||
if (el) {
|
||||
if (typeof attObj.id == 'undefined') { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
|
||||
attObj.id = id;
|
||||
}
|
||||
if (this.ua.ie && this.ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
|
||||
var att = "";
|
||||
for (var i in attObj) {
|
||||
if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
|
||||
if (i.toLowerCase() == "data") {
|
||||
parObj.movie = attObj[i];
|
||||
}
|
||||
else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
|
||||
att += ' class="' + attObj[i] + '"';
|
||||
}
|
||||
else if (i.toLowerCase() != "classid") {
|
||||
att += ' ' + i + '="' + attObj[i] + '"';
|
||||
}
|
||||
}
|
||||
}
|
||||
var par = "";
|
||||
for (var j in parObj) {
|
||||
if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
|
||||
par += '<param name="' + j + '" value="' + parObj[j] + '" />';
|
||||
}
|
||||
}
|
||||
el.outerHTML = '<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"' + att + '>' + par + '</object>';
|
||||
r = document.getElementById(attObj.id);
|
||||
}
|
||||
else { // well-behaving browsers
|
||||
var o = document.createElement('object');
|
||||
o.setAttribute("type", this.VLC_MIME_TYPE);
|
||||
for (var m in attObj) {
|
||||
if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
|
||||
if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
|
||||
o.setAttribute("class", attObj[m]);
|
||||
}
|
||||
else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
|
||||
o.setAttribute(m, attObj[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var n in parObj) {
|
||||
if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
|
||||
this.createObjParam(o, n, parObj[n]);
|
||||
}
|
||||
}
|
||||
el.parentNode.replaceChild(o, el);
|
||||
r = o;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
,createObjParam:function(el, pName, pValue) {
|
||||
var p = document.createElement("param");
|
||||
p.setAttribute("name", pName);
|
||||
p.setAttribute("value", pValue);
|
||||
el.appendChild(p);
|
||||
}
|
||||
|
||||
/* Cross-browser SWF removal
|
||||
- Especially needed to safely and completely remove a SWF in Internet Explorer
|
||||
*/
|
||||
,removeVLC:function(id) {
|
||||
var obj = document.getElementById(id);
|
||||
if (obj && obj.nodeName == "OBJECT") {
|
||||
if (this.ua.ie && this.ua.win) {
|
||||
obj.style.display = "none";
|
||||
(function(){
|
||||
if (obj.readyState == 4) {
|
||||
this.removeObjectInIE(id);
|
||||
}
|
||||
else {
|
||||
setTimeout(arguments.callee, 10);
|
||||
}
|
||||
})();
|
||||
}
|
||||
else {
|
||||
obj.parentNode.removeChild(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
,removeObjectInIE:function(id) {
|
||||
var obj = document.getElementById(id);
|
||||
if (obj) {
|
||||
for (var i in obj) {
|
||||
if (typeof obj[i] == "function") {
|
||||
obj[i] = null;
|
||||
}
|
||||
}
|
||||
obj.parentNode.removeChild(obj);
|
||||
}
|
||||
}
|
||||
|
||||
,embedVLC:function(replaceElemIdStr, widthStr, heightStr, vlcVersionStr, flashvarsObj, parObj, attObj, callbackFn) {
|
||||
var callbackObj = {success:false, id:replaceElemIdStr};
|
||||
if (this.ua.w3 && !(this.ua.wk && this.ua.wk < 312) && replaceElemIdStr && widthStr && heightStr) {
|
||||
//setVisibility(replaceElemIdStr, false);
|
||||
// addDomLoadEvent(function() {
|
||||
widthStr += ""; // auto-convert to string
|
||||
heightStr += "";
|
||||
var att = {};
|
||||
if (attObj && typeof attObj === 'object') {
|
||||
for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
|
||||
att[i] = attObj[i];
|
||||
}
|
||||
}
|
||||
// att.data = swfUrlStr;
|
||||
att.width = widthStr;
|
||||
att.height = heightStr;
|
||||
var par = {};
|
||||
if (parObj && typeof parObj === 'object') {
|
||||
for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
|
||||
par[j] = parObj[j];
|
||||
}
|
||||
}
|
||||
if (flashvarsObj && typeof flashvarsObj === 'object') {
|
||||
for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
|
||||
if (typeof par.flashvars != 'undefined') {
|
||||
par.flashvars += "&" + k + "=" + flashvarsObj[k];
|
||||
}
|
||||
else {
|
||||
par.flashvars = k + "=" + flashvarsObj[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!vlcVersionStr || hasPlayerVersion(vlcVersionStr)) { // create SWF
|
||||
var obj = this.createVLC(att, par, replaceElemIdStr);
|
||||
if (document.all) {
|
||||
|
||||
obj.style.width = widthStr;
|
||||
obj.style.height= heightStr;
|
||||
}
|
||||
if (att.id == replaceElemIdStr) {
|
||||
//setVisibility(replaceElemIdStr, true);
|
||||
}
|
||||
callbackObj.success = true;
|
||||
callbackObj.ref = obj;
|
||||
}
|
||||
|
||||
else { // show alternative content
|
||||
//setVisibility(replaceElemIdStr, true);
|
||||
}
|
||||
if (callbackFn) { callbackFn(callbackObj); }
|
||||
// });
|
||||
}
|
||||
else if (callbackFn) { callbackFn(callbackObj); }
|
||||
}
|
||||
|
||||
,embedPlayer:function(replaceElemIdStr, widthStr, heightStr, add_toolbar) {
|
||||
var tbHeight = add_toolbar?this.TOOLBAR_HEIGHT:0;
|
||||
|
||||
var plugin_height = (parseInt(heightStr) - tbHeight);
|
||||
$('#' + replaceElemIdStr).html('');
|
||||
$('#' + replaceElemIdStr).height(parseInt(heightStr));
|
||||
var tbar = "<div id='" + replaceElemIdStr + "-main' class='x-vlc-main' style='width:" + widthStr + "px;height:" + heightStr + "px' >";
|
||||
tbar += "<div id='" + replaceElemIdStr + "_plugin' class='x-vlc-plugin' ></div>";
|
||||
tbar += "<div style='overflow:hide;width:" + widthStr + "px;height:" + tbHeight + "px' id='" + replaceElemIdStr + "_toolbar', class='x-vlc-toolbar' ></div>";
|
||||
tbar += "</div>";
|
||||
$('#' + replaceElemIdStr).append(tbar )
|
||||
this.embedVLC(replaceElemIdStr + '_plugin', widthStr, plugin_height.toString());
|
||||
if (typeof(this.INSTANCES[replaceElemIdStr]) == 'undefined') {
|
||||
this.INSTANCES[replaceElemIdStr] = playerInstance(replaceElemIdStr);
|
||||
}
|
||||
|
||||
if (add_toolbar) {
|
||||
this.addToolbar(replaceElemIdStr);
|
||||
}
|
||||
else {
|
||||
$('#' + replaceElemIdStr + '_toolbar').hide(); //default hide toolba
|
||||
}
|
||||
//this.INSTANCES[replaceElemIdStr].addEvents();
|
||||
return this.INSTANCES[replaceElemIdStr];
|
||||
|
||||
}
|
||||
|
||||
|
||||
,addToolbar:function(playerId) {
|
||||
if(!playerId) playerId=this.INSTANCES[0];
|
||||
var instance = this.INSTANCES[playerId];
|
||||
var tgt = $('#' + playerId + '_toolbar');
|
||||
tgt.html('');
|
||||
this.createButton(playerId, ' ', 'x-vlc-btn-play', function(event) {
|
||||
//alert('play '+ event.data.instance.playerId);
|
||||
event.data.instance.togglePlay();
|
||||
});
|
||||
this.createButton(playerId, ' ', 'x-vlc-btn-stop', function(event) {
|
||||
//alert('stop '+ event.data.instance.playerId);
|
||||
event.data.instance.stop();
|
||||
});
|
||||
instance.createSlider();
|
||||
this.getInstance(playerId).statusChanged();
|
||||
this.createTimer(playerId);
|
||||
this.createButton(playerId, ' ', 'x-vlc-btn-fullscreen', function(event) {
|
||||
//alert('stop '+ event.data.instance.playerId);
|
||||
event.data.instance.toggleFullscreen();
|
||||
});
|
||||
this.createButton(playerId, ' ', 'x-vlc-btn-plus', function(event) {
|
||||
//alert('stop '+ event.data.instance.playerId);
|
||||
// event.data.instance.stop();
|
||||
$('#' + instance.playerId + '_about').slideToggle(0);
|
||||
});
|
||||
aboutTxt = "";
|
||||
if (instance.version()) {
|
||||
aboutTxt = 'Installed version: ' + instance.version();
|
||||
|
||||
}
|
||||
else {
|
||||
var url = "http://www.videolan.org/vlc/";
|
||||
aboutTxt = "VLC not detected. <a href='" + url + "' target='blank'>click here to install</a>";
|
||||
}
|
||||
|
||||
tgt.append('<div id="' + playerId + '_about" class="x-vlc-about" style="display:none" class="x-vlc-about">' + aboutTxt + '</div>');
|
||||
tgt.show();
|
||||
}
|
||||
,remove:function(playerId) {
|
||||
if(!playerId) playerId=this.INSTANCES[0];
|
||||
delete this.INSTANCES[playerId] ;
|
||||
}
|
||||
,createButton:function(playerId, html, cls, handler) {
|
||||
var tgt = $('#' + playerId + '_toolbar');
|
||||
var id = playerId + '_toolbar_btn' + tgt[0].childNodes.length;
|
||||
var btn = "<div id='" + id + "' style='float:left;width:16px;text-align:center;cursor:pointer' class='x-vlc-btn "+cls+"' >" + html + "</div>";
|
||||
tgt.append(btn);
|
||||
var instance = this.getInstance(playerId);
|
||||
if (handler) {
|
||||
$('#' + id).bind('click', {instance: instance}, handler);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
,createTimer:function(playerId) {
|
||||
var tgt = $('#' + playerId + '_toolbar' );
|
||||
var timer = "<div id='" + playerId + "_timer' style='float:left;text-align:center;width:100px' class='x-vlc-timer'> 00:00/00:00 </div>"
|
||||
tgt.append(timer);
|
||||
}
|
||||
|
||||
,getInstance:function(playerId) {
|
||||
return this.INSTANCES[playerId];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function playerInstance(playerId) {
|
||||
var instance = {
|
||||
playerId:playerId
|
||||
,toolbar: + '_toolbar'
|
||||
,slider:playerId + '_toolbar_slider'
|
||||
,sliderCreated:false
|
||||
,btn_play:playerId + '_toolbar_btn0'
|
||||
,plugin:playerId + '_plugin'
|
||||
,timer:playerId + '_timer'
|
||||
,status:null
|
||||
|
||||
,__getPlugin:function() {
|
||||
return $('#' + this.plugin)[0];
|
||||
}
|
||||
|
||||
// JS API
|
||||
,version:function() {
|
||||
var plugin = this.__getPlugin();
|
||||
if (!plugin) return false;
|
||||
var version = plugin.versionInfo;
|
||||
if(typeof(version)=="function") version = plugin.versionInfo();
|
||||
return version;
|
||||
|
||||
}
|
||||
,queue:function(uri) {
|
||||
var plugin = this.__getPlugin();
|
||||
if (!plugin) {
|
||||
setTimeout("VLCobject.getInstance('" + this.playerId + "').play('" + uri + "');", 500);
|
||||
return;
|
||||
}
|
||||
var options = this.options.get();
|
||||
var id = plugin.playlist.add(uri, uri, options);
|
||||
// plugin.playlist.playItem(id);
|
||||
|
||||
}
|
||||
,play:function(uri) {
|
||||
var plugin = this.__getPlugin();
|
||||
if (!plugin) {
|
||||
setTimeout("VLCobject.getInstance('" + this.playerId + "').play('" + uri + "');", 500);
|
||||
return;
|
||||
}
|
||||
var options = this.options.get();
|
||||
this.statusCheckStart();
|
||||
if (uri) {
|
||||
var id = plugin.playlist.add(uri, uri, options);
|
||||
plugin.playlist.playItem(id);
|
||||
}
|
||||
else {
|
||||
plugin.playlist.play();
|
||||
}
|
||||
|
||||
}
|
||||
,seek:function(percentage) {
|
||||
var plugin = this.__getPlugin();
|
||||
if (plugin.input.length > 0) {
|
||||
plugin.input.time = plugin.input.length * percentage / 100;
|
||||
}
|
||||
}
|
||||
,toggleFullscreen:function() {
|
||||
var plugin = this.__getPlugin();
|
||||
plugin.video.toggleFullscreen();
|
||||
//plugin.video.fullscreen();
|
||||
}
|
||||
,togglePlay:function() {
|
||||
var plugin = this.__getPlugin();
|
||||
if (plugin.playlist.isPlaying) {
|
||||
plugin.playlist.togglePause();
|
||||
}
|
||||
else {
|
||||
plugin.playlist.play();
|
||||
}
|
||||
this.statusCheckStart();
|
||||
//plugin.playlist.togglePause();
|
||||
|
||||
}
|
||||
,stop:function() {
|
||||
var plugin = this.__getPlugin();
|
||||
plugin.playlist.stop();
|
||||
//this.statusCheckStop();
|
||||
// timeout to ensure to get last events
|
||||
|
||||
setTimeout("VLCobject.getInstance('" + this.playerId + "').statusCheckStop();", 1000);
|
||||
}
|
||||
,options:{
|
||||
set:function(name, value) {
|
||||
this.items[name] = value || null;
|
||||
}
|
||||
,del:function(name) {
|
||||
delete this.items[name];
|
||||
}
|
||||
|
||||
,clear:function() {
|
||||
this.items = new Array();
|
||||
}
|
||||
|
||||
// internal use only
|
||||
,items:{}
|
||||
,get:function() {
|
||||
var tmp_array = new Array();
|
||||
var debug_str = "";
|
||||
var idx = 0;
|
||||
for (var i in this.items)
|
||||
{
|
||||
var option_str = ":" + i;
|
||||
if (this.items[i]) option_str += "=" + this.items[i];
|
||||
tmp_array[idx] = option_str;
|
||||
debug_str += option_str + " ";
|
||||
idx += 1;
|
||||
}
|
||||
if (document.all) return tmp_array;
|
||||
return debug_str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// private status stuff
|
||||
,VLC_STATUS:{
|
||||
0:'standby'
|
||||
,1:'opening'
|
||||
,2:'buffering'
|
||||
,3:'playing'
|
||||
,4:'paused'
|
||||
,5:'stopped'
|
||||
,6:'ended'
|
||||
|
||||
}
|
||||
,statusChanged:function() {
|
||||
if (!this.status) {
|
||||
this.setStatusText(this.VLC_STATUS[0]);
|
||||
var width = this.getSliderLength();
|
||||
var tb = $('#' +this.playerId + '_toolbar_slider' );
|
||||
tb.width(width);
|
||||
|
||||
return;
|
||||
}
|
||||
if (this.status == 3) {
|
||||
// playing
|
||||
//if(!this.sliderCreated) this.setStatusText('playing');
|
||||
this.setPlaying(true);
|
||||
}
|
||||
else {
|
||||
this.setPlaying(false);
|
||||
if (this.sliderCreated && this.status != 4) {
|
||||
this.updateSlider(0);
|
||||
}
|
||||
if ((this.status == 0 || this.status == 5 || this.status == 6) ) {
|
||||
this.setStatusText(this.VLC_STATUS[this.status]);
|
||||
this.sliderCreated = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!this.sliderCreated) this.setStatusText(this.VLC_STATUS[this.status]);
|
||||
return;
|
||||
|
||||
}
|
||||
,setPlaying:function(playing) {
|
||||
var tgt = $('#' + this.playerId + '_toolbar_btn0');
|
||||
|
||||
if (playing) {
|
||||
tgt.removeClass( 'x-vlc-btn-play' );
|
||||
tgt.addClass( 'x-vlc-btn-pause' );
|
||||
if(!this.sliderCreated) this.setStatusText('playing');
|
||||
}
|
||||
else {
|
||||
tgt.removeClass( 'x-vlc-btn-pause' );
|
||||
tgt.addClass( 'x-vlc-btn-play' );
|
||||
if(!this.sliderCreated) this.setStatusText('paused');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
,statusCheck:function() {
|
||||
|
||||
var plugin = this.__getPlugin();
|
||||
if (!plugin.input) return;
|
||||
var status = plugin.input.state;
|
||||
if (status != this.status) {
|
||||
this.status = status;
|
||||
this.statusChanged();
|
||||
}
|
||||
if (plugin.playlist.isPlaying) {
|
||||
|
||||
this.updatePosition(plugin.input.time / 1000, plugin.input.length / 1000)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
,statusCheckStart:function() {
|
||||
this.statusCheckStop();
|
||||
this.statusCheckTimer = setInterval("VLCobject.getInstance('" + this.playerId + "').statusCheck();", 300);
|
||||
}
|
||||
,statusCheckStop:function() {
|
||||
clearTimeout(this.statusCheckTimer);
|
||||
}
|
||||
,secsToTime:function(secs) {
|
||||
if (secs == 0) {
|
||||
return '00:00'
|
||||
}
|
||||
var secs = parseInt(secs );
|
||||
var mins = 0;
|
||||
|
||||
if (secs > 60) {
|
||||
mins = Math.floor(secs / 60);
|
||||
secs = parseInt((secs - (mins*60)));
|
||||
}
|
||||
|
||||
|
||||
return this.pad(mins,2) + ':' + this.pad(secs, 2) ;
|
||||
}
|
||||
,pad:function(number, length) {
|
||||
|
||||
var str = '' + number;
|
||||
while (str.length < length) {
|
||||
str = '0' + str;
|
||||
}
|
||||
|
||||
return str;
|
||||
|
||||
}
|
||||
,getSliderLength:function() {
|
||||
var l = ($('#'+this.plugin).width() - (105 + 100) );
|
||||
return l;
|
||||
}
|
||||
,updateSlider:function(percentage) {
|
||||
var td1 = $('#' + this.slider +' :first-child :first-child :first-child');
|
||||
var td3 = $('#' + this.slider +' :first-child :first-child :last-child');
|
||||
|
||||
var offset = this.getSliderLength();
|
||||
var w= offset * percentage ;
|
||||
td1.width(w);
|
||||
w= offset * (1-percentage) ;
|
||||
td3.width(w);
|
||||
}
|
||||
,setStatusText:function(txt) {
|
||||
this.sliderCreated = false;
|
||||
var tb = $('#' +this.playerId + '_toolbar_slider' );
|
||||
tb.html(txt);
|
||||
}
|
||||
,updatePosition:function(position, length) {
|
||||
// update timer
|
||||
$('#' + this.timer).html(this.secsToTime(position) + '/' + this.secsToTime(length));
|
||||
var tb = $('#' +this.playerId + '_toolbar_slider' );
|
||||
if (length == 0) {
|
||||
//var width = ($('#'+this.plugin).width() - 4 - 50 - $('#'+this.timer).width() );
|
||||
var width = this.getSliderLength();
|
||||
tb.width(width);
|
||||
this.sliderCreated = false
|
||||
if (position<1) this.statusChanged(); // force display stattus at startup
|
||||
}
|
||||
else {
|
||||
this.createSlider();
|
||||
this.updateSlider(position/length);
|
||||
}
|
||||
}
|
||||
// UI
|
||||
|
||||
,onSliderClick:function(event) {
|
||||
var slider = $('#' + event.data.instance.slider);
|
||||
var x = event.pageX;
|
||||
var y = event.pageY;
|
||||
var x_offset = x - slider.position().left;
|
||||
var percentage = x_offset * 100 / slider.width();
|
||||
event.data.instance.updateSlider(x_offset/slider.width());
|
||||
event.data.instance.seek(percentage);
|
||||
|
||||
|
||||
}
|
||||
,createSlider:function() {
|
||||
if ($('#' + slider_id).length > 0 && $('#' + table_id).length > 0) return;
|
||||
var offset = this.getSliderLength();
|
||||
var slider_id= this.playerId + '_toolbar_slider';
|
||||
var table_id= this.playerId + '_toolbar_slider_tb';
|
||||
|
||||
var progress = "<table id='" + table_id + "' border=0 style='margin-top:5px;height:10px;cursor:pointer;display:inline' cellpadding=0 cellspacing=0 ><tr ><td width='0' class='x-vlc-slider'></td><td class='x-vlc-slider-thumb'></td><td width='" + (offset) + "' class='x-vlc-slider'></td></tr></table>";
|
||||
|
||||
if ($('#' + slider_id).length == 0) {
|
||||
// div not preset exists
|
||||
var tgt = $('#' + this.playerId + '_toolbar' );
|
||||
var slider = "<div id='" + slider_id + "' width='" + (offset + 4)+"' style='text-align:center;float:left;height:10px'>";
|
||||
//slider += progress
|
||||
slider += "</div>";
|
||||
tgt.append(slider);
|
||||
$('#' + slider_id).bind('click', {instance:this}, this.onSliderClick);
|
||||
}
|
||||
|
||||
if ($('#' + table_id).length == 0) {
|
||||
var slider = $('#' + slider_id );
|
||||
slider.html('');
|
||||
slider.append(progress);
|
||||
}
|
||||
|
||||
this.sliderCreated = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
if (!window.opera && document.all ) {
|
||||
if (!VLCobject.unloadSet) {
|
||||
VLCobject.prepUnload = function() {
|
||||
__vlc_unloadHandler = function(){};
|
||||
__vlc_savedUnloadHandler = function(){};
|
||||
window.attachEvent("onunload", VLCobject.cleanupVLCs);
|
||||
}
|
||||
window.attachEvent("onbeforeunload", VLCobject.prepUnload);
|
||||
VLCobject.unloadSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
VLCobject.cleanupVLCs = function() {
|
||||
for (i in this.INSTANCES) {
|
||||
i.stop();
|
||||
}
|
||||
var objects = document.getElementsByTagName("OBJECT");
|
||||
for (var i = objects.length - 1; i >= 0; i--) {
|
||||
objects[i].style.display = 'none';
|
||||
for (var x in objects[i]) {
|
||||
if (typeof objects[i][x] == 'function') {
|
||||
objects[i][x] = function(){};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|