Permalink
Browse files

2.9.4 release

  • Loading branch information...
1 parent de330e8 commit 48ee388141f8d5c4ef9251fbf010d2e0ffd594bc @johndyer johndyer committed Sep 25, 2012
View
Binary file not shown.
@@ -15,7 +15,7 @@
var mejs = mejs || {};
// version number
-mejs.version = '2.9.3';
+mejs.version = '2.9.4';
// player number (for missing, same id attr)
mejs.meIndex = 0;
@@ -26,7 +26,7 @@ mejs.plugins = {
{version: [3,0], types: ['video/mp4','video/m4v','video/mov','video/wmv','audio/wma','audio/m4a','audio/mp3','audio/wav','audio/mpeg']}
],
flash: [
- {version: [9,0,124], types: ['video/mp4','video/m4v','video/mov','video/flv','video/x-flv','audio/flv','audio/x-flv','audio/mp3','audio/m4a','audio/mpeg', 'video/youtube', 'video/x-youtube']}
+ {version: [9,0,124], types: ['video/mp4','video/m4v','video/mov','video/flv','video/rtmp','video/x-flv','audio/flv','audio/x-flv','audio/mp3','audio/m4a','audio/mpeg', 'video/youtube', 'video/x-youtube']}
//,{version: [12,0], types: ['video/webm']} // for future reference (hopefully!)
],
youtube: [
@@ -774,6 +774,8 @@ mejs.MediaElementDefaults = {
pluginPath: mejs.Utility.getScriptPath(['mediaelement.js','mediaelement.min.js','mediaelement-and-player.js','mediaelement-and-player.min.js']),
// name of flash file
flashName: 'flashmediaelement.swf',
+ // streamer for RTMP streaming
+ flashStreamer: '',
// turns on the smoothing filter in Flash
enablePluginSmoothing: false,
// name of silverlight file
@@ -1151,6 +1153,7 @@ mejs.HtmlMediaElementShim = {
'width=' + width,
'startvolume=' + options.startVolume,
'timerrate=' + options.timerRate,
+ 'flashstreamer=' + options.flashStreamer,
'height=' + height];
if (playback.url !== null) {
@@ -1942,7 +1945,7 @@ if (typeof jQuery != 'undefined') {
doAnimation = typeof doAnimation == 'undefined' || doAnimation;
- if (!t.controlsAreVisible || t.options.alwaysShowControls) // attempted fix for Issue #548
+ if (!t.controlsAreVisible)
return;
if (doAnimation) {
@@ -3791,35 +3794,29 @@ if (typeof jQuery != 'undefined') {
};
- if (track.isTranslation) {
- // translate the first track
- mejs.TrackFormatParser.translateTrackText(t.tracks[0].entries, t.tracks[0].srclang, track.srclang, t.options.googleApiKey, function(newOne) {
-
- // store the new translation
- track.entries = newOne;
+ $.ajax({
+ url: track.src,
+ dataType: "text",
+ success: function(d) {
+ // parse the loaded file
+ if (typeof d == "string" && (/<tt\s+xml/ig).exec(d)) {
+ track.entries = mejs.TrackFormatParser.dfxp.parse(d);
+ } else {
+ track.entries = mejs.TrackFormatParser.webvvt.parse(d);
+ }
+
after();
- });
-
- } else {
- $.ajax({
- url: track.src,
- success: function(d) {
- // parse the loaded file
- track.entries = mejs.TrackFormatParser.parse(d);
- after();
-
- if (track.kind == 'chapters' && t.media.duration > 0) {
- t.drawChapters(track);
- }
- },
- error: function() {
- t.loadNextTrack();
+ if (track.kind == 'chapters' && t.media.duration > 0) {
+ t.drawChapters(track);
}
- });
- }
+ },
+ error: function() {
+ t.loadNextTrack();
+ }
+ });
},
enableTrackButton: function(lang, label) {
@@ -4037,53 +4034,106 @@ if (typeof jQuery != 'undefined') {
Adapted from: http://www.delphiki.com/html5/playr
*/
mejs.TrackFormatParser = {
- // match start "chapter-" (or anythingelse)
- pattern_identifier: /^([a-zA-z]+-)?[0-9]+$/,
- pattern_timecode: /^([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,
+ webvvt: {
+ // match start "chapter-" (or anythingelse)
+ pattern_identifier: /^([a-zA-z]+-)?[0-9]+$/,
+ pattern_timecode: /^([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,
- split2: function (text, regex) {
- // normal version for compliant browsers
- // see below for IE fix
- return text.split(regex);
- },
- parse: function(trackText) {
- var
- i = 0,
- lines = this.split2(trackText, /\r?\n/),
- entries = {text:[], times:[]},
- timecode,
- text;
-
- for(; i<lines.length; i++) {
- // check for the line number
- if (this.pattern_identifier.exec(lines[i])){
- // skip to the next line where the start --> end time code should be
- i++;
- timecode = this.pattern_timecode.exec(lines[i]);
-
- if (timecode && i<lines.length){
- i++;
- // grab all the (possibly multi-line) text that follows
- text = lines[i];
+ parse: function(trackText) {
+ var
+ i = 0,
+ lines = mejs.TrackFormatParser.split2(trackText, /\r?\n/),
+ entries = {text:[], times:[]},
+ timecode,
+ text;
+ for(; i<lines.length; i++) {
+ // check for the line number
+ if (this.pattern_identifier.exec(lines[i])){
+ // skip to the next line where the start --> end time code should be
i++;
- while(lines[i] !== '' && i<lines.length){
- text = text + '\n' + lines[i];
+ timecode = this.pattern_timecode.exec(lines[i]);
+
+ if (timecode && i<lines.length){
+ i++;
+ // grab all the (possibly multi-line) text that follows
+ text = lines[i];
i++;
+ while(lines[i] !== '' && i<lines.length){
+ text = text + '\n' + lines[i];
+ i++;
+ }
+ text = $.trim(text).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
+ // Text is in a different array so I can use .join
+ entries.text.push(text);
+ entries.times.push(
+ {
+ start: (mejs.Utility.convertSMPTEtoSeconds(timecode[1]) == 0) ? 0.200 : mejs.Utility.convertSMPTEtoSeconds(timecode[1]),
+ stop: mejs.Utility.convertSMPTEtoSeconds(timecode[3]),
+ settings: timecode[5]
+ });
}
-
- // Text is in a different array so I can use .join
- entries.text.push(text);
- entries.times.push(
- {
- start: mejs.Utility.timeCodeToSeconds(timecode[1]),
- stop: mejs.Utility.timeCodeToSeconds(timecode[3]),
- settings: timecode[5]
- });
}
}
+ return entries;
}
+ },
+ // Thanks to Justin Capella: https://github.com/johndyer/mediaelement/pull/420
+ dfxp: {
+ parse: function(trackText) {
+ trackText = $(trackText).filter("tt");
+ var
+ i = 0,
+ container = trackText.children("div").eq(0),
+ lines = container.find("p"),
+ styleNode = trackText.find("#" + container.attr("style")),
+ styles,
+ begin,
+ end,
+ text,
+ entries = {text:[], times:[]};
+
+
+ if (styleNode.length) {
+ var attributes = styleNode.removeAttr("id").get(0).attributes;
+ if (attributes.length) {
+ styles = {};
+ for (i = 0; i < attributes.length; i++) {
+ styles[attributes[i].name.split(":")[1]] = attributes[i].value;
+ }
+ }
+ }
- return entries;
+ for(i = 0; i<lines.length; i++) {
+ var style;
+ var _temp_times = {
+ start: null,
+ stop: null,
+ style: null
+ };
+ if (lines.eq(i).attr("begin")) _temp_times.start = mejs.Utility.convertSMPTEtoSeconds(lines.eq(i).attr("begin"));
+ if (!_temp_times.start && lines.eq(i-1).attr("end")) _temp_times.start = mejs.Utility.convertSMPTEtoSeconds(lines.eq(i-1).attr("end"));
+ if (lines.eq(i).attr("end")) _temp_times.stop = mejs.Utility.convertSMPTEtoSeconds(lines.eq(i).attr("end"));
+ if (!_temp_times.stop && lines.eq(i+1).attr("begin")) _temp_times.stop = mejs.Utility.convertSMPTEtoSeconds(lines.eq(i+1).attr("begin"));
+ if (styles) {
+ style = "";
+ for (var _style in styles) {
+ style += _style + ":" + styles[_style] + ";";
+ }
+ }
+ if (style) _temp_times.style = style;
+ if (_temp_times.start == 0) _temp_times.start = 0.200;
+ entries.times.push(_temp_times);
+ text = $.trim(lines.eq(i).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
+ entries.text.push(text);
+ if (entries.times.start == 0) entries.times.start = 2;
+ }
+ return entries;
+ }
+ },
+ split2: function (text, regex) {
+ // normal version for compliant browsers
+ // see below for IE fix
+ return text.split(regex);
}
};
Oops, something went wrong.

0 comments on commit 48ee388

Please sign in to comment.