forked from hoyois/plugin-to-html5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlowplayer.js
75 lines (62 loc) · 1.93 KB
/
Flowplayer.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
addKiller("Flowplayer", {
"canKill": function(data) {
return /(?:^|&)config=/.test(data.params.flashvars);
},
"process": function(data, callback) {
try {
var config = JSON.parse(parseFlashVariables(data.params.flashvars).config.replace(/\n/g, " "));
} catch(e) {
return;
}
var baseURL;
if(config.clip) baseURL = config.clip.baseUrl;
var playlist = [];
var audioOnly = true;
var splash;
var parseTitle = function(title) {return title;};
if(/bimvid_player/.test(data.src)) parseTitle = function(title) {return unescapeHTML(title.replace(/\+/g, " "));};
if(config.playList) config.playlist = config.playList;
if(typeof config.playlist !== "object") {
if(config.clip) config.playlist = [config.clip];
else if(data.params.href) config.playlist = [data.params.href];
else return;
}
config.playlist.forEach(function(clip) {
if(typeof clip === "string") clip = {"url": clip};
if(!clip.url) return;
if(clip.live) return;
if(clip.provider === "rtmp") return;
clip.url = decodeURIComponent(clip.url);
var source = extInfo(getExt(clip.url));
if(source) {
var base = clip.baseUrl ? clip.baseUrl : baseURL;
if(base && !/^https?:/.test(clip.url)) {
base = decodeURIComponent(base);
if(!/\/$/.test(base) && !/^\//.test(clip.url)) base += "/";
source.url = base + clip.url;
} else {
source.url = clip.url;
}
var poster;
if(clip.coverImage) poster = decodeURIComponent(clip.coverImage.url);
else if(clip.overlay) poster = decodeURIComponent(clip.overlay);
else poster = splash;
splash = undefined;
playlist.push({
"title": parseTitle(clip.title),
"poster": poster,
"sources": [source]
});
if(!source.isAudio) audioOnly = false;
} else {
var ext = getExt(clip.url);
if(ext === "jpg" || ext === "png") splash = clip.url;
else splash = undefined;
}
});
if(playlist.length !== 0) callback({
"playlist": playlist,
"audioOnly": audioOnly
});
}
});