Menu

[r308]: / trunk / player / StrobeMediaPlayback / html-template / lib / StrobeMediaPlayer.js  Maximize  Restore  History

Download this file

129 lines (118 with data), 3.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
var strobeMediaPlayback = function () {
var settings = {
"tablet": {
"startSize": {"width":480, "height":268},
"wmode": "direct"
},
"smartphone": {
"startSize": {"width":120, "height":67},
"wmode": "direct"
},
"default": {
"startSize": {"width":480, "height":268},
"wmode": "direct"
}
};
function getStartSize(deviceType) {
if (deviceType in settings) {
return settings[deviceType]["startSize"];
}
else {
return settings["default"]["startSize"];
}
}
function getAutoplay(deviceType) {
if (deviceType in settings) {
return (settings[deviceType]["autoplay"] ? settings[deviceType]["autoplay"] : false);
}
else {
return (settings["default"]["autoplay"] ? settings["default"]["autoplay"] : false);
}
}
function getWMode(deviceType) {
if (deviceType in settings) {
return (settings[deviceType]["wmode"] ? settings[deviceType]["wmode"] : "direct");
}
else {
return (settings["default"]["wmode"] ? settings["default"]["wmode"] : "direct");
}
}
function getFlashvars(deviceType) {
if (deviceType in settings) {
return (settings[deviceType]["flashvars"] ? settings[deviceType]["flashvars"] : {});
}
else {
return (settings["default"]["flashvars"] ? settings["default"]["flashvars"] : {});
}
}
return {
settings: function(object) {
settings = $.extend(true, settings, object);
},
draw: function(object) {
if (object) {
var agent = window.location.hash.replace(/^#/, "");
function onDeviceDetection(device) {
var startSize = getStartSize(device.getProfile().type);
if (device.profileDetected() && device.useFlash()) {
var flashvars = getFlashvars(device.getProfile().type);
if(device.getProfile().type == "tablet" || device.getProfile().type == "smartphone"){
flashvars.skin = "skins/"+device.getProfile().type+"-skin.xml";
flashvars.controlBarType = device.getProfile().type;
flashvars.playButtonOverlay = false;
}
flashvars.autoPlay = getAutoplay(device.getProfile().type);
var params = {
movie: "StrobeMediaPlayback.swf",
allowfullscreen: "true",
allowscriptaccess: "always",
wmode:getWMode(device.getProfile().type)
};
var attributes = {};
$("#" + object["element"]).parent().css("width",startSize["width"]);
$("#" + object["element"]).parent().css("height",startSize["height"]);
flashvars.src = object["url"];
flashvars.poster = object["poster"];
swfobject.embedSWF(
"StrobeMediaPlayback.swf",
object["element"],
startSize["width"],
startSize["height"],
"10.1.0",
"",
flashvars,
params,
attributes
);
}
else {
var html5divs =
'<div class="html5player">' +
'<div class="errorwindow"></div>' +
'<div class="controls">' +
'<div class="icon playtoggle">Play/Pause</div>' +
'<div class="timestamp current">0:00</div>' +
'<div class="progress">' +
'<a class="slider"></a>' +
'<div class="tracks">' +
'<div class="seeking"></div>' +
'<div class="played"></div>' +
'<div class="buffered"></div>' +
'</div>' +
'</div>' +
'<div class="timestamp duration">0:00</div>' +
'<div class="icon fullview">Full View</div>' +
'</div>' +
'<video width="' + startSize["width"] + '" height="' + startSize["height"] + '" preload="none" poster="' + object["poster"] + '">' +
'<source src="' + object["url"] + '" />' +
'</video>' +
'</div>';
$("#" + object["element"]).html(html5divs);
$("#" + object["element"] + " .html5player").strobemediaplaybackhtml5();
}
}
new DeviceDetection(agent).addCallback(onDeviceDetection).addProfiles(profiles).detect();
}
}
}
}();
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.