-
Notifications
You must be signed in to change notification settings - Fork 0
/
talk_webrtc.html
110 lines (93 loc) · 8.52 KB
/
talk_webrtc.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
<!DOCTYPE html><html><head><meta charset="utf-8" /><title>FitMi 雲端減重</title><meta content="width=device-width, initial-scale=1.0" name="viewport" /><meta content="chrome=1" http-equiv="X-UA-Compatible" /><!--metadata--><meta content="zh-tw" http-equiv="content-language" /><meta content="減肥,減重,體重,瘦身,記錄,熱量,卡路里,窈窕,飲食,健身,運動,節食,控制,身材,小腹,日記,healthy,weight,thin,fat,diet,diary,BMI" name="keywords" /><meta content="你是否嘗試過各種減重的方法? 始終找不到一個好的方法呢? FitMi減重服務採用自然的飲食調整,及正確的心理建設,在減重過程提供專業建議與關懷陪伴,輔以網路科技。讓你以你做得到的前提,而且能持續做的方式,輕鬆健康瘦下來,建立正確的觀念讓你在結束後不再復胖。" name="description" /><meta content="NOODP" name="robots" /><meta content="fitmi.com.tw" name="copyright" /><!--Bootstrap--><link href="css/b3/bootstrap.min.css" media="screen" rel="stylesheet" /><!--Stylesheet--><link href="stylesheets/styles.css" rel="stylesheet" /><!--web Font--><!--Optimizely--><script src="//cdn.optimizely.com/js/227369404.js"></script><!--OpenTok JavaScript library --><script src="https://swww.tokbox.com/webrtc/v2.0/js/TB.min.js"></script><style type="text/css">.OT_publisher .OT_opentok {
width: 48px;
background: url(images/rtc/buttons.png) 0 -65px no-repeat;
}</style><!--UA-39388572-1--><script type="text/javascript">(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-39388572-1', 'fitmi.com.tw');
ga('send', 'pageview');</script></head><body><header class="navbar navbar-fixed-top large"><div class="vi_light_bar"></div><div class="header"><div class="navbar-inner"><button class="navbar-toggle" data-target=".navbar-responsive-collapse" data-toggle="collapse" type="button"></button><h1 class="brand navbar-brand"><a href="characteristic.html"><span class="brand-logo">FitMi 雲端減重</span></a></h1><div class="nav-collapse collapse navbar-responsive-collapse"><ul class="nav navbar-nav main_nav"><li id="menu-item-1"><a href="aboutus.html"><span class="title">關於我們</span></a></li><li id="menu-item-2"><a href="characteristic.html"><span class="title">FitMi特點</span></a></li><li id="menu-item-3"><a href="service.html"><span class="title">服務方式</span></a></li><li id="menu-item-4"><a href="feedback.html"><span class="title">見證</span></a></li></ul></div></div></div></header><div class="banner" style="height:200px"><div class="container"><div class="inner"><div class="bg01"></div><div class="slogan"></div></div></div></div><div class="page_content_wrapper"><div class="container page_content"><div class="col-12"><div class="jumbotron"><h2>視訊</h2><div class="panel"><div class="panel-heading clearfix"><input class="btn btn-success btn-lg pull-lleft" id="publishLink" onClick="javascript:startPublishing()" type="button" value="啟動視訊分享" /></div><div class="panel-body clearfix"><div class="publisherContainer pull-left" id="myCamera"></div><div class="pull-right" id="subscribers"></div></div><div class="alert alert-danger" style="clear:both;margin-top:20px;font-size:15px;"><button aria-hidden="true" class="close" data-dismiss="alert" style="font-size:15px;" type="button">關閉提示 ×</button><h3>注意事項!</h3><hr /><div class="pd20"><ol><li>1.網頁載入後按下 <input class="btn btn-success" id="publishLink" onClick="javascript:startPublishing()" type="button" value="啟動視訊分享" /> 按鈕</li><li>2.允許您的瀏覽器使用視訊與麥克風設備</li><li>3.結束後退出本頁面</li></ol></div></div></div></div></div></div></div><script type="text/javascript">var apiKey = "38302552"; // Replace with your API key. See https://dashboard.tokbox.com/projects
var sessionId = "2_MX4zODMwMjU1Mn4xMjcuMC4wLjF-RnJpIEF1ZyAxNiAwMjo0MDowNyBQRFQgMjAxM34wLjA2Mjc5MDgxfg"; // Replace with your own session ID. See https://dashboard.tokbox.com/projects
var token = "T1==cGFydG5lcl9pZD0zODMwMjU1MiZzZGtfdmVyc2lvbj10YnJ1YnktdGJyYi12MC45MS4yMDExLTAyLTE3JnNpZz1jNjEyZGY4OGFkMWI3OWMzMTNhOTNjNmE3NjAzYmJjNjRkZDJhZjY2OnJvbGU9cHVibGlzaGVyJnNlc3Npb25faWQ9Ml9NWDR6T0RNd01qVTFNbjR4TWpjdU1DNHdMakYtUm5KcElFRjFaeUF4TmlBd01qbzBNRG93TnlCUVJGUWdNakF4TTM0d0xqQTJNamM1TURneGZnJmNyZWF0ZV90aW1lPTEzNzY2NDYwMDgmbm9uY2U9MC44OTQ0OTEwNzk1NTI3MjE5JmV4cGlyZV90aW1lPTEzNzY3MzI0MDcmY29ubmVjdGlvbl9kYXRhPQ=="; // Replace with a generated token. See https://dashboard.tokbox.com/projects
var session;
var publisher;
var subscribers = {};
var VIDEO_WIDTH = 320;
var VIDEO_HEIGHT = 240;
TB.addEventListener("exception", exceptionHandler);
// Un-comment the following to set automatic logging:
// TB.setLogLevel(TB.DEBUG);
if (TB.checkSystemRequirements() != TB.HAS_REQUIREMENTS) {
alert("You don't have the minimum requirements to run this application."
+ "Please upgrade to the latest version of Flash.");
} else {
session = TB.initSession(sessionId); // Initialize session
// Add event listeners to the session
session.addEventListener('sessionConnected', sessionConnectedHandler);
session.addEventListener('connectionCreated', connectionCreatedHandler);
session.addEventListener('streamCreated', streamCreatedHandler);
}
//--------------------------------------
// LINK CLICK HANDLERS
//--------------------------------------
/*
If testing the app from the desktop, be sure to check the Flash Player Global Security setting
to allow the page from communicating with SWF content loaded from the web. For more information,
see http://www.tokbox.com/opentok/docs/js//tutorials/helloworld.html#localTest
*/
function connect() {
session.connect(apiKey, token);
}
// Called when user wants to start publishing to the session
function startPublishing() {
if (!publisher) {
var parentDiv = document.getElementById("myCamera");
var publisherDiv = document.createElement('div'); // Create a div for the publisher to replace
publisherDiv.setAttribute('id', 'opentok_publisher');
parentDiv.appendChild(publisherDiv);
var publisherProps = {width: VIDEO_WIDTH, height: VIDEO_HEIGHT};
publisher = TB.initPublisher(apiKey, publisherDiv.id, publisherProps); // Pass the replacement div id and properties
session.publish(publisher);
show('unpublishLink');
hide('publishLink');
}
}
//--------------------------------------
// OPENTOK EVENT HANDLERS
//--------------------------------------
function sessionConnectedHandler(event) {
// Subscribe to all streams currently in the Session
for (var i = 0; i < event.streams.length; i++) {
addStream(event.streams[i]);
}
}
function streamCreatedHandler(event) {
// Subscribe to the newly created streams
for (var i = 0; i < event.streams.length; i++) {
addStream(event.streams[i]);
}
}
function connectionCreatedHandler(event) {
// This signals new connections have been created.
}
/*
If you un-comment the call to TB.setLogLevel(), above, OpenTok automatically displays exception event messages.
*/
function exceptionHandler(event) {
alert("Exception: " + event.code + "::" + event.message);
}
//--------------------------------------
// HELPER METHODS
//--------------------------------------
function addStream(stream) {
// Check if this is the stream that I am publishing, and if so do not publish.
if (stream.connection.connectionId == session.connection.connectionId) {
return;
}
var subscriberDiv = document.createElement('div'); // Create a div for the subscriber to replace
subscriberDiv.setAttribute('id', stream.streamId); // Give the replacement div the id of the stream as its id.
document.getElementById("subscribers").appendChild(subscriberDiv);
var subscriberProps = {width: VIDEO_WIDTH, height: VIDEO_HEIGHT};
subscribers[stream.streamId] = session.subscribe(stream, subscriberDiv.id, subscriberProps);
}
connect();</script><!--Grab Google CDN's jQuery, fall back to local if offline--><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script><script type="text/javascript">window.jQuery || document.write('<script src="js/libs/jquery-1.10.1.min.js"><\/script>')</script><script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script><script src="js/bootstrap.min.js"></script><script type="text/javascript">$(".alert").alert();</script><script src="js/script.js"></script></body></html>