forked from nailanawshaba/Browser_Feature_Detection-legacy-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·66 lines (60 loc) · 1.81 KB
/
index.html
File metadata and controls
executable file
·66 lines (60 loc) · 1.81 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dolby Feature Detection Tutorial</title>
<link rel="stylesheet" href="lib/highlight/github-gist.css"/>
<link rel="stylesheet" href="styles/dolby.css"/>
</head>
<body>
<h1>Dolby Sample Code Example</h1>
<h3 id="video-title">Video Player</h3>
<div id="video-container" class="video-container">
<video src="assets/dolby.mp4" controls></video>
</div>
<br/>
<h3>HTML Code</h3>
<pre>
<code class="html">
<video src="assets/dolby.mp4" controls></video>
</code>
</pre>
<h3>How to Browser Detect for Dolby Digital Plus JavaScript Code - Listed Below <span class="sub">(<a target="_blank" href="scripts/feature-detection.js">download *.js file</a>)</span></h3>
<pre>
<code class="js">
var Dolby = Dolby || {};
(function (start) {
'use strict';
var video = document.createElement('video');
if (video.canPlayType('audio/mp4;codecs="ec-3"') === '' ) {
Dolby.supportDDPlus = false;
start();
} else {
var audio = new Audio();
audio.muted = true;
audio.addEventListener('error', function () {
Dolby.supportDDPlus = false;
start();
}, false);
audio.addEventListener('seeked', function () {
Dolby.supportDDPlus = true;
start();
}, false);
audio.addEventListener('canplaythrough', function () {
try {
audio.currentTime = 2;
} catch (e) {
}
}, false);
audio.src = 'assets/silence.mp4';
audio.play();
}
}(Dolby.init));
</code>
</pre>
<script src="lib/highlight/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="scripts/dolby.js"></script>
<script src="scripts/feature-detection.js"></script>
</body>
</html>