Skip to content

Commit

Permalink
minor VLC / browser model fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
frankyghost committed Nov 5, 2013
1 parent 3455795 commit d421540
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 39 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
PROJEKKTOR - simply mighty <video>
http://www.projekktor.com

V1.2.39
V1.3.0
=======

addtions:
* [core] added OSMF player model
* [core] "streamType" can now be specified separately for each alternate media entry of a playlist item (allows mixing e.g. of RTMP, HTTP for one single playlist item)
* [core] made mJpeg multipart streams available for clients with VLC Web Plugin

fixes:
* [core] fixed jQuery 1.4 issues
Expand All @@ -15,7 +16,7 @@ V1.2.39
changes:
* [core] made OSMF player model default
* [core] missing or broken plugins are now reported via an alert()

* [core] set default duration for images to one second


V1.2.38
Expand Down
2 changes: 1 addition & 1 deletion src/controller/projekktor.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ projekktor = $p = function() {

function PPlayer(srcNode, cfg, onReady) {

this.config = new projekktorConfig('1.2.39');
this.config = new projekktorConfig('1.3.0');

this.env = {
muted: false,
Expand Down
57 changes: 31 additions & 26 deletions src/controller/projekktor.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jQuery(function ($) {
.attr('unselectable', 'on')
.bind("selectstart", function () {
return false;
})
});
return dest;
},

Expand All @@ -59,7 +59,7 @@ jQuery(function ($) {
try {
if ($.inArray(array1[i], array2) > -1) result.push(array1[i]);
} catch (e) {}
})
});
return result;
},

Expand Down Expand Up @@ -90,7 +90,7 @@ jQuery(function ($) {
}

h = l.protocol + '//' + l.host;
if (s.indexOf('/') == 0) {
if (s.indexOf('/')===0) {
return h + s;
}

Expand Down Expand Up @@ -123,16 +123,15 @@ jQuery(function ($) {
* @return (Integer) Absolute seconds
*/
toSeconds: function (t) {

var s = 0.0
var s = 0.0;
if (typeof t != 'string') return t;
if (t) {
var p = t.split(':');
if (p.length > 3)
p = p.slice(0, 3);

for (i = 0; i < p.length; i++)
s = s * 60 + parseFloat(p[i].replace(',', '.'))
s = s * 60 + parseFloat(p[i].replace(',', '.'));
}

return parseFloat(s);
Expand Down Expand Up @@ -232,7 +231,7 @@ jQuery(function ($) {
top: 0,
left: 0
})
)
);
}

return $('#' + domOptions.id);
Expand Down Expand Up @@ -285,8 +284,9 @@ jQuery(function ($) {
if (target == null)
return false;

if ((target instanceof $) == false)
target = $(target)
if ((target instanceof $)===false) {
target = $(target);
}

if (!target.data('od')) {
target.data('od', {
Expand Down Expand Up @@ -334,8 +334,9 @@ jQuery(function ($) {
wid = $p.utils.roundNumber((rw / wid) * 100, 0);
hei = $p.utils.roundNumber((rh / hei) * 100, 0);

if (wid == 0 || hei == 0)
if (wid===0 || hei===0) {
return false;
}

target.css({
'margin': 0,
Expand Down Expand Up @@ -388,8 +389,9 @@ jQuery(function ($) {
// http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
log: function () {

if (this.logging == false)
if (this.logging===false) {
return;
}

this.history = this.history || []; // store logs to an array for reference
this.history.push(arguments);
Expand Down Expand Up @@ -454,12 +456,13 @@ jQuery(function ($) {

versionCompare: function (installed, required) {
var a = installed.split('.'),
b = required.split('.');
b = required.split('.'),
i = 0;

for (var i = 0; i < a.length; ++i) {
for (i = 0; i < a.length; ++i) {
a[i] = Number(a[i]);
}
for (var i = 0; i < b.length; ++i) {
for (i = 0; i < b.length; ++i) {
b[i] = Number(b[i]);
}
if (a.length == 2) {
Expand Down Expand Up @@ -499,25 +502,27 @@ jQuery(function ($) {
var n, v, json = [], arr = (obj && obj.constructor == Array);

for (n in obj) {
v = obj[n];
t = typeof(v);
if (obj.hasOwnProperty(n)) {
if (t == "string") {
v = '"' + v + '"';
} else if (t == "object" && v !== null){
v = $p.utils.stringify(v);
}

json.push((arr ? "" : '"' + n + '":') + String(v));
}
if (obj.hasOwnProperty(n)) {
v = obj[n];
t = typeof(v);
if (obj.hasOwnProperty(n)) {
if (t == "string") {
v = '"' + v + '"';
} else if (t == "object" && v !== null){
v = $p.utils.stringify(v);
}

json.push((arr ? "" : '"' + n + '":') + String(v));
}
}
}

return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
}
},

logging: false
}
};
});


Expand Down
17 changes: 8 additions & 9 deletions src/models/player.audio.video.vlc.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ $p.newModel({
var ref = navigator.plugins[i][j];
if (ref.suffixes!=null && ref.type!=null) {
$.each(ref.suffixes.split(','), function(key, value) {
model.iLove.push( {ext:value, type: ref.type.replace(/x-/, ''), platform:['vlc'], streamType: ['rtsp', 'http', 'pseudo', 'httpVideo']} );
model.iLove.push( {ext:value, type: ref.type.replace(/x-/, ''), platform:['vlc'], streamType: ['rtsp', 'http', 'pseudo', 'httpVideo', 'multipart']} );
})
}
}
Expand Down Expand Up @@ -124,29 +124,29 @@ $p.newModel({
* Handle Events
****************************************/
addListeners: function() {
if (this.mediaElement==null) return;

var ref = this;

$.each(this._eventMap, function(event, value){
try {
if (ref.mediaElement.get(0).attachEvent) {
// Microsoft
ref.mediaElement.get(0).attachEvent (event, function(evt) {ref[value](this, evt)});
ref.mediaElement.get(0).attachEvent (event, function(evt) {ref[value](this, evt);});
} else if ( ref.mediaElement.get(0).addEventListener) {
// Mozilla: DOM level 2
ref.mediaElement.get(0).addEventListener (event, function(evt) {ref[value](this, evt)}, false);
ref.mediaElement.get(0).addEventListener (event, function(evt) {ref[value](this, evt);}, false);
} else {
// DOM level 0
ref.mediaElement.get(0)["on" + event] = function(evt) {ref[value](this, evt)};
ref.mediaElement.get(0)["on" + event] = function(evt) {ref[value](this, evt);};
}
} catch(e){}
});

},

removeListener: function(evt, subId) {
if (this.mediaElement==null) return;
if (this.mediaElement==null) {
return;
}
var id = (subId!=null) ? '.projekktor'+subId+this.pp.getId() : '.projekktor'+this.pp.getId(),
ref = this;

Expand All @@ -161,7 +161,7 @@ $p.newModel({
this.timeListener({
position: this.mediaElement.get(0).input.time / 1000,
duration: this.mediaElement.get(0).input.length / 1000
})
});
},

seekableListener: function() {
Expand Down Expand Up @@ -192,7 +192,6 @@ $p.newModel({
},



/*****************************************
* Setters
****************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/models/player.image.html.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $p.newModel({

applyMedia: function(destContainer) {
this.mediaElement = this.applyImage(this.media.file[0].src, destContainer.html(''));
this._duration = this.pp.getConfig('duration');
this._duration = this.pp.getConfig('duration') || 1;
this._position = -1;
this.displayReady();
this._position = -0.5;
Expand Down

0 comments on commit d421540

Please sign in to comment.