added embedded videos,streams,clips for twitch
This commit is contained in:
parent
326a82ad8f
commit
bf47792b67
@ -232,12 +232,12 @@ plugins.factory('userPlugins', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Twitch Clips Embedded Player
|
* Twitch Embedded Player
|
||||||
*
|
*
|
||||||
* See: https://dev.twitch.tv/docs/embed/video-and-clips/#non-interactive-iframes-for-clips
|
* See: https://dev.twitch.tv/docs/embed/video-and-clips/#non-interactive-iframes-for-clips
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var twitchClipsPlugin = new UrlPlugin('TwitchClips video', function(url) {
|
var twitchPlugin = new UrlPlugin('Twitch video', function(url) {
|
||||||
var regex = /(?:https?:\/\/)?clips\.twitch\.tv\/([^\?\&\/\s]+)/i,
|
var regex = /(?:https?:\/\/)?clips\.twitch\.tv\/([^\?\&\/\s]+)/i,
|
||||||
match = url.match(regex);
|
match = url.match(regex);
|
||||||
|
|
||||||
@ -251,6 +251,23 @@ plugins.factory('userPlugins', function() {
|
|||||||
.attr('height', '315')
|
.attr('height', '315')
|
||||||
.attr('allowfullscreen', 'true');
|
.attr('allowfullscreen', 'true');
|
||||||
return element.prop('outerHTML');
|
return element.prop('outerHTML');
|
||||||
|
}
|
||||||
|
|
||||||
|
var regex = /(?:https?:(?:\/\/www\.)?)?twitch\.tv\/(?:videos\/(\d+)|(\w+))/i,
|
||||||
|
match = url.match(regex);
|
||||||
|
if (match) {
|
||||||
|
var mediaType = "video";
|
||||||
|
if(match[1] === undefined) {
|
||||||
|
mediaType = "channel";
|
||||||
|
}
|
||||||
|
var mediaId = match[1] === undefined ? match[2] : match[1];
|
||||||
|
var embedurl = "https://player.twitch.tv/?" + mediaType + "=" + mediaId + "&parent=" + window.location.hostname + "&autoplay=false&muted=true";
|
||||||
|
var element = angular.element('<iframe></iframe>')
|
||||||
|
.attr('src', embedurl)
|
||||||
|
.attr('width', '560')
|
||||||
|
.attr('height', '315')
|
||||||
|
.attr('allowfullscreen', 'true');
|
||||||
|
return element.prop('outerHTML');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -613,7 +630,7 @@ plugins.factory('userPlugins', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
plugins: [youtubePlugin, twitchClipsPlugin, dailymotionPlugin, allocinePlugin, imagePlugin, videoPlugin, audioPlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, pastebinPlugin, giphyPlugin, tweetPlugin, streamablePlugin, tikTokPlugin]
|
plugins: [youtubePlugin, twitchPlugin, dailymotionPlugin, allocinePlugin, imagePlugin, videoPlugin, audioPlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, pastebinPlugin, giphyPlugin, tweetPlugin, streamablePlugin, tikTokPlugin]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user