Skip to content

Commit

Permalink
Merge pull request mediaelement#1135 from clkao/youtu.be-url
Browse files Browse the repository at this point in the history
Support youtu.be URL for youtube source
  • Loading branch information
johndyer committed Mar 27, 2014
2 parents e14d121 + 3727523 commit f443739
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/js/me-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,18 @@ mejs.HtmlMediaElementShim = {
case 'youtube':


var
var videoId;
// youtu.be url from share button
if (playback.url.lastIndexOf("youtu.be") != -1) {
videoId = playback.url.substr(playback.url.lastIndexOf('/')+1);
if (videoId.indexOf('?') != -1) {
videoId = videoId.substr(0, videoId.indexOf('?'));
}
}
else {
videoId = playback.url.substr(playback.url.lastIndexOf('=')+1);
youtubeSettings = {
}
youtubeSettings = {
container: container,
containerId: container.id,
pluginMediaElement: pluginMediaElement,
Expand Down

0 comments on commit f443739

Please sign in to comment.