-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
128 lines (114 loc) · 4.2 KB
/
index.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html>
<head lang="en-IE">
<meta charset="utf-8">
<title>HTML5 Video Voice Control with the Web Speech API</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/style.css" rel="stylesheet" media="all">
</head>
<body>
<main role="main">
<h1>What would you like to learn today</h1>
<div>
<p>
Some suggestions, <a href="https://www.youtube.com/results?search_query=how+to+put+on+eyeliner"> make-up</a>, how to play a song on an instrument you have, <a href = "https://www.youtube.com/results?search_query=how+to+do+a+coin+trick">magic trick</a>, etc.
</p>
</div>
Copy and paste the URL here: <input type="url" id="channel" size="60"> </input>
<button id="mybutton" type="button" onClick="changeVideo();">Change Video</button>
<br><br>
<iframe id="v"
width="640" height="360"
src="https://www.youtube.com/embed/M7lc1UVf-VE?enablejsapi=1"
frameborder="0"
style="border: solid 4px #37474F"
></iframe>
<!--<video id="v" controls preload="metadata">
<source src="video/crane.mp4" type="video/mp4">
</video>
-->
<!-- <input id="vol-control" type="range" min="0" max="100" step="1" oninput="SetVolume(this.value)" onchange="SetVolume(this.value)"></input>
-->
<div class="rec-status">Recogniser status:<span id="recStatus"> OFF </span></div>
<br><br>
<div class="rec-text">I'm hearing:<span id="recText"></span></div>
<div class="marker-text">your marker at time:<span id="markerText"></span></div>
<br><br>
<button id="startRecBtn">Start Recognition</button>
<button id="stopRecBtn">Stop Recognition</button>
<button id="nextBtn" onclick="printTime()"> print time </button>
<div>
<p>Available commands are:</p></div>
<ul>
<li id="vidPlay">"play"</li>
<li id="vidStop">"stop"</li>
<li id="vidWait">"hold on" or "wait"</li>
<li id="vidReplay">"replay"</li>
<li id="vidMute">"mute"</li>
<li id="vidUnmute">"unmute"</li>
<li id="vidVolInc">"louder"</li>
<li id="vidVolDec">"softer" or "quieter"</li>
<li id="vidFF">"fastforward (fastforward 10 seconds)"</li>
<li id="vidRew">"rewind (rewind 10 seconds)"</li>
<li id="vidSetMarker">"set marker here"</li>
<li id="vidGetMarker">"go to marker"</li>
<li id="vidNextStep">"next"</li>
<li id="vidPrevStep">"before" or "go back one step"</li>
</ul>
<div>Please send your comments / feedback / questions<a href ="https://goo.gl/forms/rLvn9cKdDDgB9IiH2"> HERE. </a></div>
<!-- <div><a href="todo.html">pipeline and todo</a></div> -->
</main>
<script src="js/video-speech.js" defer></script>
<script>
function SetVolume(val)
{
var player = document.getElementById('v');
console.log('Before: ' + player.volume);
player.volume = val / 100;
console.log('After: ' + player.volume);
}
function printTime(){
var video = document.getElementById('v');
console.log(video.currentTime)
}
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
// 3. This function creates an <iframe> (and YouTube player)
// after the API code downloads.
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('v', {
height: '390',
width: '640',
//videoId: '',
events: {
'onReady': onPlayerReady
}
});
}
// 4. The API will call this function when the video player is ready.
function onPlayerReady(event) {
event.target.playVideo();
}
var url;
function changeVideo(event){
url = document.getElementById("channel").value;
//console.log(url);
url = url.replace("watch?v=", "embed/");
//console.log(url);
document.getElementById("v").src = url;
event.target.playVideo();
}
function stopVideo() {
player.stopVideo();
}
</script>
<!--
<script>
var _gaq=[['_setAccount','UA-2046650-1'],['_trackPageview']];(function(a,b){var c=a.createElement(b),d=a.getElementsByTagName(b)[0];c.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";d.parentNode.insertBefore(c,d)})(document,"script");
</script>
-->
</body>
</html>