]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/standalone/videos/embed.html
Fix error display for embeds
[github/Chocobozzz/PeerTube.git] / client / src / standalone / videos / embed.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <meta name="robots" content="noindex">
7 <meta property="og:platform" content="PeerTube" />
8
9 <script type="text/javascript">
10 // Thanks: https://mathiasbynens.be/notes/globalthis
11 (function() {
12 if (typeof globalThis === 'object') return;
13 Object.prototype.__defineGetter__('__magic__', function() {
14 return this;
15 });
16 __magic__.globalThis = __magic__
17 delete Object.prototype.__magic__;
18 }());
19 </script>
20
21
22 <!-- /!\ The following comment is used by the server to prerender some tags /!\ -->
23
24 <!-- title tag -->
25 <!-- description tag -->
26 <!-- custom css tag -->
27 <!-- meta tags -->
28 <!-- server config -->
29
30 <!-- /!\ Do not remove it /!\ -->
31
32 <link rel="icon" type="image/png" href="/client/assets/images/favicon.png" />
33 </head>
34
35 <body id="custom-css" class="standalone-video-embed">
36
37 <div id="error-block">
38 <h1 id="error-title"></h1>
39
40 <div id="error-content"></div>
41 </div>
42
43 <div id="video-wrapper"></div>
44
45 <div id="placeholder-preview"></div>
46
47 <script type="text/javascript">
48 // Can be called in embed.ts
49 window.displayIncompatibleBrowser = function () {
50 const text = 'The player is not compatible with your web browser. Please try latest Firefox version.'
51
52 document.title = 'Sorry' + ' - ' + text
53
54 const errorBlock = document.getElementById('error-block')
55 errorBlock.style.display = 'flex'
56
57 const errorTitle = document.getElementById('error-title')
58 errorTitle.innerHTML = 'Sorry'
59
60 const errorText = document.getElementById('error-content')
61 errorText.innerHTML = text
62
63 const videoWrapper = document.getElementById('video-wrapper')
64 if (videoWrapper) videoWrapper.style.display = 'none'
65
66 const placeholderPreview = document.getElementById('placeholder-preview')
67 if (placeholderPreview) placeholderPreview.style.display = 'none'
68 }
69
70 window.onerror = function () {
71 window.displayIncompatibleBrowser()
72 }
73
74 if (/MSIE|Trident/.test(window.navigator.userAgent) ) {
75 window.displayIncompatibleBrowser()
76 }
77 </script>
78
79 </body>
80 </html>