aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-09-02 09:31:07 +0200
committerChocobozzz <me@florianbigard.com>2021-09-02 09:31:07 +0200
commitc21a0aa855f61daaca458e16b47f95278898beb4 (patch)
tree007e28debbf935f7115dbcf1db81168e1b59cac5
parentf4e75a6fd037c396b532e0cfc0a48d769e29f6ae (diff)
downloadPeerTube-c21a0aa855f61daaca458e16b47f95278898beb4.tar.gz
PeerTube-c21a0aa855f61daaca458e16b47f95278898beb4.tar.zst
PeerTube-c21a0aa855f61daaca458e16b47f95278898beb4.zip
Display a message in embed on unsupported web browser
-rw-r--r--client/src/standalone/videos/embed.html26
-rw-r--r--client/src/standalone/videos/embed.ts14
2 files changed, 33 insertions, 7 deletions
diff --git a/client/src/standalone/videos/embed.html b/client/src/standalone/videos/embed.html
index 3455b4aa4..8ec03d199 100644
--- a/client/src/standalone/videos/embed.html
+++ b/client/src/standalone/videos/embed.html
@@ -44,5 +44,31 @@
44 44
45 <div id="placeholder-preview"></div> 45 <div id="placeholder-preview"></div>
46 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
64 window.onerror = function () {
65 window.displayIncompatibleBrowser()
66 }
67
68 if (/MSIE|Trident/.test(window.navigator.userAgent) ) {
69 window.displayIncompatibleBrowser()
70 }
71 </script>
72
47 </body> 73 </body>
48</html> 74</html>
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index 36480922e..a6f0b2ed9 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -258,12 +258,8 @@ export class PeerTubeEmbed {
258 } 258 }
259 259
260 async init () { 260 async init () {
261 try { 261 this.userTokens = Tokens.load()
262 this.userTokens = Tokens.load() 262 await this.initCore()
263 await this.initCore()
264 } catch (e) {
265 console.error(e)
266 }
267 } 263 }
268 264
269 private initializeApi () { 265 private initializeApi () {
@@ -791,4 +787,8 @@ export class PeerTubeEmbed {
791} 787}
792 788
793PeerTubeEmbed.main() 789PeerTubeEmbed.main()
794 .catch(err => console.error('Cannot init embed.', err)) 790 .catch(err => {
791 (window as any).displayIncompatibleBrowser()
792
793 console.error('Cannot init embed.', err)
794 })