Skip to content

Commit

Permalink
Merge pull request #266 from LaurentGoderre/master
Browse files Browse the repository at this point in the history
Feature multimedia player - IE 7 error fixed
  • Loading branch information
LaurentGoderre committed Aug 22, 2012
2 parents 7119520 + 2a56e61 commit 697ba1d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build/js/pe-ap-min.js

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions src/js/workers/multimedia.js
Expand Up @@ -253,7 +253,7 @@

if (captions !== undefined) {
media.after($('<div class="wet-boew-multimedia-captionsarea"/>').hide());
_pe.fn.multimedia._load_captions(media, evtmgr, captions);
_pe.fn.multimedia._load_captions(evtmgr, captions);
}
}

Expand Down Expand Up @@ -385,7 +385,7 @@
}
},

_load_captions : function (media, evtmgr, src) {
_load_captions : function (evtmgr, src) {
var parse_time,
parse_html,
parse_xml,
Expand Down Expand Up @@ -427,40 +427,36 @@
captions = [];

te.each(function () {
var e = $(this).clone(),
var e = $(this),
begin = -1,
end = -1,
c,
json;
e.find(s).detach();

if (e.attr('data-begin') !== undefined) {
//HTML5 captions (seperate attributes)
begin = parse_time(e.attr('data-begin'));
end = e.attr('data-end') !== undefined ? parse_time(e.attr('data-end')) : parse_time(e.attr('data-dur')) + begin;
} else {
if (e.attr('data')) {
//HTML5 captions JSON in data attribute
json = e.attr('data');
} else {
//XHTML cations (inside the class attribute)
c = e.attr('class');
json = c.substring(c.indexOf('{'));
}
} else if (e.attr('data') !== undefined) {
json = e.attr('data');

//Sanitze the JSON
json = json.replace(/(begin|dur|end)/gi, '"$1"').replace(/'/g, '"');
json = $.parseJSON(json);

begin = parse_time(json.begin);
end = json.end !== undefined ? parse_time(json.end) : parse_time(json.dur) + begin;

}
//Removes nested captions if any
e = e.clone();
e.find(s).detach();

captions[captions.length] = {
text : e.html(),
begin : begin,
end : end
};


});
return captions;
};
Expand All @@ -471,13 +467,17 @@
captions = [];

te.each(function () {
var e = $(this).clone(),
var e = $(this),
begin = -1,
end = -1;

e.find(s).detach();
begin = parse_time(e.attr('begin'));
end = e.attr('end') !== undefined ? parse_time(e.attr('end')) : parse_time(e.attr('dur')) + begin;

//Removes nested captions if any
e = e.clone();
e.find(s).detach();

captions[captions.length] = {
text : e.html(),
begin : begin,
Expand All @@ -501,7 +501,7 @@
url : url,
context : evtmgr,
dataType : 'html',
success : function (data, status, response) {
success : function (data) {
var eventObj = {type: 'captionsloaded'};
if (data.indexOf('<html') > -1) {
eventObj.captions = parse_html($(data));
Expand Down Expand Up @@ -559,7 +559,7 @@

//Method to allow the flash player to trigger the media events
_pe.triggermediaevent = function (id, event) {
var o = $('#' + id).find('param:eq(0)').trigger(event);
$('#' + id).find('param:eq(0)').trigger(event);
};

window.pe = _pe;
Expand Down

0 comments on commit 697ba1d

Please sign in to comment.