-
Notifications
You must be signed in to change notification settings - Fork 12
/
primitives-using-mediastream.html
62 lines (54 loc) · 1.72 KB
/
primitives-using-mediastream.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
<!DOCTYPE html>
<html>
<head>
<title><%= htmlWebpackPlugin.options.title %> - Usage with primitives and MediaStream</title>
<meta charset=utf-8 />
<link rel="icon" sizes="192x192" href="https://aframe.io/images/aframe-logo-192.png">
<script src="assets/aframe/aframe.min.js"></script>
<%= htmlWebpackPlugin.tags.headTags %>
<body>
<header is="example-header" title="Usage with primitives and MediaStream"></header>
<main>
<!-- EXAMPLE -->
<audio id="streamSrcFile" src="assets/static/audio/track.mp3"></audio>
<a-scene embedded>
<a-resonance-audio-room
visualize="true"
position="0 0 -5"
width="4"
height="4"
depth="4"
ambisonic-order="3"
speed-of-sound="343"
left="brick-bare"
right="curtain-heavy"
front="plywood-panel"
back="glass-thin"
down="parquet-on-concrete"
up="acoustic-ceiling-tiles">
<a-resonance-audio-src
visualize="true"
position="0 0 0"
src=""></a-resonance-audio-src>
</a-resonance-audio-room>
<a-sky color="#6EBAA7"></a-sky>
</a-scene>
<!-- / EXAMPLE -->
</main>
<footer is="docs-footer"/></footer>
<a is="github-corner"></a>
<script>
window.setTimeout(function(){
// This is only to show that the component works with streams, by turning an audio file into a stream.
const srcEl = document.querySelector('#streamSrcFile')
// Turn audio element into stream.
const captureStream = srcEl.mozCaptureStream ||
srcEl.captureStream ||
function() {throw new Error('browser does not support capture into stream')}
const stream = captureStream.call(srcEl)
// Set resonance audio src to stream.
document.querySelector('a-resonance-audio-src').setAttribute('resonance-audio-src', 'src', stream)
// Start stream.
srcEl.play()
}, 3000);
</script>