-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathbackend.js
67 lines (54 loc) · 1.68 KB
/
backend.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
var Player = function(ui) {
var player = ui._context.createElement('video')
player.dom.preload = "metadata"
player.setAttribute("data-dashjs-player", "")
this.element = player
this.ui = ui
this.setEventListeners()
ui.element.remove()
ui.element = player
ui.parent.element.append(ui.element)
this.dash = dashjs.MediaPlayer().create();
this.dash.initialize(player.dom)
}
Player.prototype = Object.create(_globals.video.html5.backend.Player.prototype)
Player.prototype.setSource = function(url) {
log("dashjs::setSource", url)
this.ui.ready = false
this.dash.attachSource(url)
if (this.ui.autoPlay)
this.play()
}
Player.prototype.setupDrm = function(type, options, callback, error) {
var drmConfig = {}
if (type === "widevine") {
drmConfig["com.widevine.alpha"] = {
"serverURL": options.laServer,
"systemStringPriority": ["com.widevine.something", "com.widevine.alpha"],
"priority": 1
}
} else if (type === "playready") {
drmConfig["com.microsoft.playready"] = {
"serverURL": options.laServer,
"priority": 1,
"systemStringPriority": ["com.microsoft.playready.something", "com.microsoft.playready.recommendation", "com.microsoft.playready.hardware", "com.microsoft.playready"]
}
} else {
error ? error(new Error("Unknown or not supported DRM type " + type)) : log("Unknown or not supported DRM type " + type)
}
this.dash.setProtectionData(drmConfig)
if (callback)
callback()
}
exports.createPlayer = function(ui) {
return new Player(ui)
}
exports.probeUrl = function(url) {
return 10
}
Player.prototype.dispose = function() {
_globals.video.html5.backend.Player.prototype.dispose.apply(this)
this.dash.reset()
this.dash = null
}
exports.Player = Player