-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmodule-rtc-media.html
113 lines (104 loc) · 6.22 KB
/
module-rtc-media.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<title>rtc.io</title>
<link rel="stylesheet" type="text/css" href="css/reset.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<!-- responsive -->
<link rel="stylesheet" media="screen and (max-width: 960px)" href="css/tablet.css">
<link rel="stylesheet" media="screen and (max-width: 710px)" href="css/phone.css">
<link rel="stylesheet" type="text/css" href="fonts/source-sans/stylesheet.css">
<link rel="stylesheet" type="text/css" href="css/code.css">
</head>
<body>
<a class="scroll-point pt-top" name="top"></a>
<header>
<a href="https://github.com/rtc-io/rtc-media"><img class="fork" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub"></a>
<a class="scroll-point pt-top" name="top"></a>
<div class="site">
<div class="mascot">
<img src="images/artsio.png">
</div>
<div class="logo" data-subtext="OpenSource WebRTC">
<a href="index.html">rtc.io</a>
</div>
<nav>
<ul>
<li><a href="index.html">About</a></li>
<li><a href="tutorials.html">Tutorials</a></li>
<li><a href="demos.html">Demos</a></li>
<li><a href="modules.html">Modules</a></li>
</ul>
</nav>
</div>
<div class="shadow"></div>
</header>
<div class="main" role="content"><h1 id="rtc-media">rtc-media</h1>
<p>This is a convenience function for invoking media capture and rendering
using the <a href="https://github.com/rtc-io/rtc-capture"><code>rtc-capture</code></a> and
<a href="https://github.com/rtc-io/rtc-attach"><code>rtc-attach</code></a> packages respectively
within an application.</p>
<p><a href="https://nodei.co/npm/rtc-media/"><img src="https://nodei.co/npm/rtc-media.png" alt="NPM"></a></p>
<p><a href="https://github.com/dominictarr/stability#unstable"><img src="https://img.shields.io/badge/stability-unstable-yellowgreen.svg" alt="unstable"></a>
<a href="https://groups.google.com/forum/#!forum/rtc-io"><img src="http://img.shields.io/badge/discuss-rtc.io-blue.svg" alt="rtc.io google group"></a></p>
<h2 id="example-usage">Example Usage</h2>
<p>Default constraints <code>{ audio: true, video: true }</code> capture and rendering
an new video element within the document.body:</p>
<div class="highlight"><pre><span class="c1">// capture using default constraints and render a new video element</span>
<span class="c1">// in the document body</span>
<span class="nx">require</span><span class="p">(</span><span class="s1">'rtc-media'</span><span class="p">)({</span> <span class="nx">target</span><span class="o">:</span> <span class="nb">document</span><span class="p">.</span><span class="nx">body</span> <span class="p">});</span>
</pre></div>
<p>In the event that you wish to make use of any of the rtc.io plugins, then
the following example demonstrates how to provide a single "capture and
render" call that will work with a plugin:</p>
<div class="highlight"><pre><span class="kd">var</span> <span class="nx">crel</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'crel'</span><span class="p">);</span>
<span class="c1">// ensure we have a style tag that tells the video renderer what size it should be</span>
<span class="nb">document</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">crel</span><span class="p">(</span><span class="s1">'style'</span><span class="p">,</span> <span class="p">[</span>
<span class="s1">'body { margin: 0px; width: 100vw; height: 100vh; overflow: hidden }'</span><span class="p">,</span>
<span class="s1">'body > * { width: 100%; height: 100%; object-fit: contain }'</span>
<span class="p">].</span><span class="nx">join</span><span class="p">(</span><span class="s1">'\n'</span><span class="p">)));</span>
<span class="c1">// specify a plugin</span>
<span class="nx">require</span><span class="p">(</span><span class="s1">'rtc-media'</span><span class="p">)({</span>
<span class="nx">target</span><span class="o">:</span> <span class="nb">document</span><span class="p">.</span><span class="nx">body</span><span class="p">,</span>
<span class="nx">plugins</span><span class="o">:</span> <span class="p">[</span>
<span class="nx">require</span><span class="p">(</span><span class="s1">'rtc-plugin-nicta-ios'</span><span class="p">)</span>
<span class="p">]</span>
<span class="p">});</span>
</pre></div>
<h2 id="license-s-">License(s)</h2>
<h3 id="apache-2-0">Apache 2.0</h3>
<p>Copyright 2014 National ICT Australia Limited (NICTA)</p>
<p> Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at</p>
<pre><code> http://www.apache.org/licenses/LICENSE-2.0</code></pre>
<p> Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.</p>
</div>
<footer>
<p>
<a href="http://nicta.com.au">
<img src="images/nicta-logo.gif" alt="NICTA logo">
</a>© NICTA 2013 - 2014
</p>
<p class="license">Project source code is licensed under the <a href="https://github.com/rtc-io/rtc/blob/master/LICENSE">Apache 2.0</a>.</p>
<a class="closing" href="#top"></a>
</footer>
</body>
<script src="js/app.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-26567546-2', 'rtc.io');
ga('send', 'pageview');
</script>
</html>