<center>
<button id="startButton"> запись </button>
<button id="stopButton"> стоп </button><br /><br />
<video id="preview" width="320" height="240" style="border-style: solid" autoplay muted></video>
<video id="recording" width="320" height="240" controls hidden></video><br /><br />
<a id="downloadButton" hidden>скачать</a>
</center>
<script>
function startRecording(stream, lengthInMS) {
let recorder = new MediaRecorder(stream);
let data = [];
recorder.ondataavailable = event => data.push(event.data);
recorder.start();
let stopped = new Promise((resolve, reject) => {
recorder.onstop = resolve;
recorder.onerror = event => reject(event.name);
});
return Promise.all([stopped, new Promise(resolve => setTimeout(resolve, lengthInMS)).then(() => recorder.state == "съёмка" && recorder.stop())]).then(() => data);
}
startButton.addEventListener("click", function() {
navigator.mediaDevices.getUserMedia({
video: true,
audio: true
}).then(stream => {
preview.srcObject = stream;
preview.captureStream = preview.captureStream;
return new Promise(resolve => preview.onplaying = resolve);
}).then(() => startRecording(preview.captureStream(), 5000)).then (recordedChunks => {
recording.hidden = false;
preview.hidden = true;
recording.src = downloadButton.href = URL.createObjectURL(new Blob(recordedChunks, { type: "video/webm" }));
recording.play();
downloadButton.hidden = false;
downloadButton.download = "RecordedVideo.webm";
});
}, false);
stopButton.addEventListener("click", function() {preview.srcObject.getTracks().forEach(track => track.stop())}, false);
recording.onended = () => recording.currentTime = 0;
</script>
range.setAttribute('max', video.duration);
video.onloadeddata = () => range.setAttribute('max', video.duration);
<script type="text/javascript" src="https://files.fm/embed/player?hash=vdp2sbxg3&w=100%&h=auto" id="filesfm_embed_js__vdp2sbxg3"></script>
<h1 id=h1></h1>
<script>
let radius = 70;
let text = "corporate*service*";
let step = Math.PI * 2 / text.length;
for(i = 0; i < text.length; i ++){
let x = radius + radius * Math.sin(i * step);
let y = radius + radius * Math.cos(i * step);
let myspan = document.createElement("span");
myspan.innerText = text[i];
myspan.style.position = "absolute";
myspan.style.left = x + "px";
myspan.style.bottom = y + "px";
myspan.style.transform = "rotateZ(" + i * 360 / text.length + "deg)";
h1.appendChild(myspan);
}
</script>
var url = new URL(location.href);
var id = url.searchParams.get("id");
var name = url.searchParams.get("name");
console.log(id + ", " + name);
video.onloadeddata = () => alert(video.duration);
<button onclick='console.log(video.duration)'> жми </button>
<audio id=audio src="sound.mp3" controls></audio>
<script>
audio.onplay = () => {
let a = new AudioContext(),
pt = [a.createMediaElementSource(audio), a.createDelay(5.0), a.createGain(), a.destination];
pt[1].delayTime.setValueAtTime(0.5, a.currentTime);
pt[2].gain.setValueAtTime(0.7, a.currentTime);
for(i = 0; i < 2; i ++) for(j = 2; j < 4; j ++) pt[i].connect(pt[j]);
pt[2].connect(pt[1]);
}
</script>
<a id=mya href=#>Ссылка</a>
<script>
let linx = ['http://site.ru', 'http://mysite.ru', 'http://site.com', 'http://mysite.com', 'http://meineliebesite.ru']; // список сайтов
if(!localStorage.getItem('siteNumber')){
localStorage.setItem('siteNumber', '0');
}
mya.href = linx[localStorage.getItem('siteNumber')];
mya.onclick = () => {
let a = localStorage.getItem('siteNumber');
a ++;
if(a >= linx.length) a = 0;
localStorage.setItem('siteNumber', a);
}
</script>
<input type=text id=txt /><br />
<button onclick="location.href='result.html?'+txt.value"> отправить в result.html </button>
<script>
var result = location.search.substring(1);
alert(result);
</script>