mirror of
https://github.com/videojs/video.js.git
synced 2024-12-10 11:10:19 +02:00
59 lines
2.2 KiB
JavaScript
59 lines
2.2 KiB
JavaScript
_V_.H5swf.prototype.swf = "../flash/video-js.swf";
|
|
|
|
$(function(){
|
|
var tech, i, tname, player,
|
|
techList = ["HTML5","H5swf"],
|
|
props = "error,currentSrc,networkState,buffered,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoWidth,videoHeight,textTracks,preload,currentTime,defaultPlaybackRate,playbackRate,autoplay,loop,controls,volume,muted,defaultMuted,poster".split(","),
|
|
methods = "play,pause,src,load,canPlayType,addTextTrack",
|
|
notUsed = "mediaGroup,controller,videoTracks,audioTracks,defaultPlaybackRate";
|
|
|
|
|
|
for (i=0; i < techList.length; i++) {
|
|
tech = techList[i];
|
|
tname = tech.toLowerCase();
|
|
|
|
player = _V_("vid"+(i+1), { "techOrder":[tech] });
|
|
|
|
_V_.each(_V_.HTML5.events, function(evt){
|
|
|
|
player.addEvent(evt, _V_.proxy(tname, function(evt){
|
|
var eventsId = "#"+this+"_events",
|
|
type = evt.type,
|
|
prev = $(eventsId+" div").first();
|
|
|
|
if (prev && prev.html() && prev.html().indexOf(type + " ") === 0) {
|
|
var countSpan = prev.children(".count");
|
|
countSpan.html(parseInt(countSpan.html() || 1) + 1);
|
|
} else {
|
|
$("#"+this+"_events").prepend("<div>" + evt.type + " <span class='count'></span></div>");
|
|
}
|
|
}));
|
|
});
|
|
|
|
var propTable = $("#"+tname+"_props");
|
|
_V_.each(props, function(prop){
|
|
propTable.append("<tr><th>"+prop+"</th><td id='"+tname+prop+"' class='data'></td></tr>")
|
|
});
|
|
|
|
setInterval(_V_.proxy(player, function(){
|
|
_V_.each(props, _V_.proxy(this, function(prop){
|
|
var result = ""
|
|
try {
|
|
result = this[prop]();
|
|
if (result === false) result = "false";
|
|
if (result === true) result = "true";
|
|
if (result === "") result = "''";
|
|
if (result === null) result = "<span class='undefined'>null</span>";
|
|
if (result === undefined) result = "<span class='undefined'>undefined</span>";
|
|
if (typeof result.start == "function") {
|
|
result = (result.length > 0) ? "s:"+result.start(0)+" e:"+result.end(0) : "-";
|
|
}
|
|
} catch(e) {
|
|
result = "<span class='na'>N/A</span>";
|
|
}
|
|
$("#"+this.techName+prop).html(result);
|
|
}));
|
|
}), 500);
|
|
|
|
};
|
|
}); |