forked from hoyois/plugin-to-html5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IGN.js
43 lines (35 loc) · 1.15 KB
/
IGN.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
addKiller("IGN", {
"canKill": function(data) {
return /\/IGNPlayer\.swf/.test(data.src);
},
"process": function(data, callback) {
var configURL = decodeURIComponent(parseFlashVariables(data.params.flashvars).url).replace(/[?#].*/, "");
if(!/\.config$/.test(configURL)) configURL += ".config";
var _this = this;
var xhr = new XMLHttpRequest();
xhr.open("GET", configURL, true);
xhr.addEventListener("load", function() {
_this.processConfig(JSON.parse(xhr.responseText), !/^http:\/\/www\.ign\.com\/videos\//.test(data.location), callback);
}, false);
xhr.send(null);
},
"processConfig": function(config, isEmbed, callback) {
var media = config.playlist.media;
var siteInfo;
if(isEmbed) siteInfo = {"name": "IGN", "url": media.metadata.url.replace(/\\\//g, "/")};
var videoURL = media.url.replace(/\\\//g, "/");
var source = extInfo(getExt(videoURL));
if(!source) return;
source.url = videoURL;
source.height = 720;
var poster = media.poster[0].url.replace(/\\\//g, "/").replace(/\{size\}/, "large");
callback({
"playlist": [{
"title": media.metadata.title,
"sources": [source],
"poster": poster,
"siteInfo": siteInfo
}]
});
}
});