Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don’t do AJAX if track src doesn’t exist #1886

Merged
merged 1 commit into from Oct 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 29 additions & 27 deletions src/js/mep-feature-tracks.js
Expand Up @@ -239,37 +239,39 @@
};


$.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.webvtt.parse(d);
}
if (track.src !== undefined || track.src !== "") {
$.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.webvtt.parse(d);
}

after();
after();

if (track.kind == 'chapters') {
t.media.addEventListener('play', function() {
if (t.media.duration > 0) {
t.displayChapters(track);
}
}, false);
}
if (track.kind == 'chapters') {
t.media.addEventListener('play', function() {
if (t.media.duration > 0) {
t.displayChapters(track);
}
}, false);
}

if (track.kind == 'slides') {
t.setupSlides(track);
if (track.kind == 'slides') {
t.setupSlides(track);
}
},
error: function() {
t.removeTrackButton(track.srclang);
t.loadNextTrack();
}
},
error: function() {
t.removeTrackButton(track.srclang);
t.loadNextTrack();
}
});
});
}
},

enableTrackButton: function(lang, label) {
Expand Down