forked from hoyois/plugin-to-html5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathВКонтакте.js
38 lines (31 loc) · 1.63 KB
/
ВКонтакте.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
addKiller("ВКонтакте", {
"canKill": function(data) {
return data.src.indexOf("vkontakte.ru/swf/") !== -1 || data.src.indexOf("vk.com/swf/") !== -1;
},
"process": function(data, callback) {
var flashvars = parseFlashVariables(data.params.flashvars);
var posterURL = decodeURIComponent(flashvars.jpg || flashvars.thumb);
var title = unescapeHTML(decodeURIComponent(flashvars.md_title));
var sources = [];
var host = decodeURIComponent(flashvars.host);
var hd = parseInt(flashvars.hd);
if(flashvars.uid && flashvars.uid !== "0") {
var url = "http://cs" + host + ".vk.com/u" + decodeURIComponent(flashvars.uid) + "/videos/" + decodeURIComponent(flashvars.vtag) + ".";
if(hd >= 3) sources.push({"url": url + "720.mp4", "format": "720p MP4", "height": 720, "isNative": true,});
if(hd >= 2) sources.push({"url": url + "480.mp4", "format": "480p MP4", "height": 480, "isNative": true,});
if(hd >= 1) sources.push({"url": url + "360.mp4", "format": "360p MP4", "height": 360, "isNative": true});
if(flashvars.no_flv === "1") {
sources.push({"url": url + "240.mp4", "format": "240p MP4", "height": 240, "isNative": true});
} else if(canPlayFLV) {
sources.push({"url": url + "flv", "format": "240p FLV", "height": 240, "isNative": false});
}
} else if(canPlayFLV) {
if(!/^http:/.test(host)) host = "http://" + host;
var url = host + "/assets/video/" + decodeURIComponent(flashvars.vtag) + decodeURIComponent(flashvars.vkid) + ".vk.flv";
sources.push({"url": url, "format": "240p FLV", "height": 240, "isNative": false});
}
callback({
"playlist": [{"poster": posterURL, "title": title, "sources": sources}]
});
}
});