-
Notifications
You must be signed in to change notification settings - Fork 63
/
customErrorMessage.html
210 lines (188 loc) · 7.35 KB
/
customErrorMessage.html
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bitmovin Demo</title>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400" rel="stylesheet">
<link rel="icon" type="image/png" href="../images/bit-fav.png">
<!-- Bitmovin player -->
<script src="//cdn.bitmovin.com/player/web/8/bitmovinplayer.js"></script>
<!-- Bitmovin player UI-->
<script src="//cdn.bitmovin.com/player/web/8/bitmovinplayer-ui.js"></script>
<link rel="stylesheet" href="//cdn.bitmovin.com/player/web/8/bitmovinplayer-ui.css"/>
<!-- Bootstrap 3.3.7 -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<!-- Bitmovin Demo CSS -->
<style>
html, body {
margin: 0;
padding: 0;
/*height: 100%;*/
font-family: 'Open Sans', sans-serif;
font-weight: 300;
}
body {
background: rgba(44, 131, 185, 1);
background: -moz-linear-gradient(left, rgba(44, 131, 185, 1) 0%, rgba(30, 171, 227, 1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(44, 131, 185, 1)), color-stop(100%, rgba(30, 171, 227, 1)));
background: -webkit-linear-gradient(left, rgba(44, 131, 185, 1) 0%, rgba(30, 171, 227, 1) 100%);
background: -o-linear-gradient(left, rgba(44, 131, 185, 1) 0%, rgba(30, 171, 227, 1) 100%);
background: -ms-linear-gradient(left, rgba(44, 131, 185, 1) 0%, rgba(30, 171, 227, 1) 100%);
background: linear-gradient(to right, rgba(44, 131, 185, 1) 0%, rgba(30, 171, 227, 1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#2c83b9', endColorstr='#1eabe3', GradientType=1);
}
#wrapper {
background: url(../images/logo-bg-demopage.png);
height: 100vh;
}
#banner {
border-bottom: 1px solid #fff;
background-color: #1eabe3;
width: 100%
}
#banner h1 {
margin: 0;
padding: 30px;
}
#banner .logo {
padding: 10px;
width: 25%;
min-width: 350px;
float: left;
margin: auto;
}
#banner .title {
width: 75%;
white-space: nowrap;
}
h1.bitmovin-headline, h2.bitmovin-headline, h3.bitmovin-headline, p {
color: #fff;
font-weight: 300;
text-align: center;
margin: 40px;
}
.bitmovin-description {
padding: 45px 0;
color: white;
font-size: large;
}
#player {
-webkit-box-shadow: 0px 0px 56px 0px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0px 0px 56px 0px rgba(0, 0, 0, 0.75);
box-shadow: 0px 0px 56px 0px rgba(0, 0, 0, 0.75);
}
a {
color: #97d9ef;
font-weight: 400;
text-decoration: none;
}
a:hover {
color: #fff;
}
@media (max-width: 1000px) {
.logo {
width: 100%;
}
.title {
display: none;
}
}
</style>
</head>
<body>
<div id="wrapper">
<div id="banner">
<div class="logo"><a href="https://bitmovin.com"><img src="../images/bitmovin-logo.png"></a></div>
<div class="title"><h1 class="bitmovin-headline">Custom Error Messages</h1></div>
<div class="clearfix"></div>
</div>
<div class="container-fluid">
<div class="content">
<div class="row bitmovin-description">
<div class="col-lg-12 text-center">This example shows how you can show customize error messages by
providing a configuration object to the ErrorMessageOverlay UI component
</div>
</div>
<div class="row">
<div class="col-md-offset-1 col-md-10 col-lg-offset-2 col-lg-8">
<div id="player"></div>
</div>
</div>
<div class="row">
<div class="col-lg-12 text-center">
<p>For more information about the bitmovin player, please have a look at our online <a
href="https://developer.bitmovin.com" target="_blank">Developer Section</a>.</p>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var conf = {
key: "YOUR-PLAYER-LICENSE-KEY",
ui: false,
events: {
error: function (details) {
console.log("onError", details);
},
},
};
var source = {
title: "Bitmovin Player",
description: "This example shows how you can show custom error messages using a custom config for the ErrorMessageOverlay UI component",
dash: "https://bitdash-a.akamaihd.net/content/sintel/sintel.mpd",
hls: "https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8",
poster: "https://bitmovin.com/wp-content/uploads/2016/06/sintel-poster.jpg",
// drm: {
// widevine: {
// LA_URL: "INVALID_LICENSING_URL",
// },
// },
};
var player = new bitmovin.player.Player(document.getElementById('player'), conf);
//catch all error messages
var customAllErrorMessageOverlayConfig = function (error) {
switch (error.code) {
// DRM: License request failed
case 2003:
case 2006:
return 'This is a customized DRM Licensing Error Message';
}
// Return unmodified error message for all other errors
return bitmovin.playerui.ErrorUtils.defaultErrorMessages[error.code];
};
//catch only specific error messages
var customSpecificErrorMessageOverlayConfig = {
// Overwrite error 1000 'Error is unknown'
1000: 'Houston, we have a problem',
// Transform error 1202 'Unsupported manifest format' to uppercase
1202: function (error) {
var message = bitmovin.playerui.ErrorUtils.defaultErrorMessages[error.code];
return message.toUpperCase();
},
// Customize error 1208 'Could not load manifest, got HTTP status code XXX'
1208: function (error) {
var statusCode = error.data.statusCode;
return 'Manifest loading failed with HTTP error ' + statusCode;
},
2003: 'This is another customized DRM Licensing Error Message',
2006: 'This is a customized DRM Licensing Error Message',
};
var uiConfig = {
errorMessages: customAllErrorMessageOverlayConfig,
// errorMessages: customSpecificErrorMessageOverlayConfig, // using a dictionary instead of a function
};
var myUiManager;
myUiManager = bitmovin.playerui.UIFactory.buildDefaultUI(player, uiConfig);
player.load(source).then(function () {
console.log('Successfully loaded source');
}, function () {
console.log('Error while loading source');
});
</script>
</body>
</html>