screen / upload / play / pause

This commit is contained in:
Mark Nadal 2020-03-21 15:50:24 -07:00
parent d45d6c4d0e
commit 5323a300ff
2 changed files with 39 additions and 1 deletions

View File

@ -44,7 +44,7 @@ record.save = function(data){
$('#play').on('click', ()=>{
if(record.playing){
$('#play').text("Play")
$('#video').get(0).stop();
$('#video').get(0).pause();
record.playing = false;
return;
}

View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<video id="video" width="100%"></video>
<center>
<span id="up">Drag & Drop Video to Upload!</span>
<button id="play">Play</button>
</center>
<script src="../jquery.js"></script>
<script src="../../../gun/gun.js"></script>
<script src="../../../gun/lib/upload.js"></script>
<script>
var gun = Gun(location.origin + '/gun');
var video = {data: null};
$('body').upload(function(e){
var b64 = (((e.event || e).target || e).result || e);
gun.get('test').get('screen').put(b64);
})
gun.get('test').get('screen').on((data)=>{
if(!data){ return }
$('#video').get(0).src = video.data = data;
})
$('#play').on('click', ()=>{
if(video.playing || !video.data){
$('#play').text("Play")
$('#video').get(0).pause();
video.playing = false;
return;
}
$('#play').text("Stop");
video.playing = true;
$('#video').get(0).play()
})
</script>