From 23c0430897fa9ebbee39b44cd87252937d8c9bec Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 25 Jul 2020 12:13:52 +0000 Subject: works now! --- gst/gst.go | 3 +-- index.html | 21 +++++++++++---------- main.go | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/gst/gst.go b/gst/gst.go index 7282aab..5bfc940 100644 --- a/gst/gst.go +++ b/gst/gst.go @@ -40,8 +40,7 @@ demux. ! videoconvert ! videoscale ! video/x-raw,width=800,height=600 -! x264enc bframes=0 speed-preset=veryfast key-int-max=60 -! video/x-h264,stream-format=byte-stream +! vp8enc deadline=1 ! appsink name=video demux. diff --git a/index.html b/index.html index 9f88bb2..f01ad13 100644 --- a/index.html +++ b/index.html @@ -20,17 +20,8 @@ pc.addTransceiver('video', {direction: 'recvonly'}); pc.addTransceiver('audio', {direction: 'recvonly'}); - window.seekClick = () => { - conn.send(JSON.stringify({event: 'seek', data: document.getElementById('seekTime').value})) - } - window.playClick = () => { - conn.send(JSON.stringify({event: 'play', data: ''})) - } - window.pauseClick = () => { - conn.send(JSON.stringify({event: 'pause', data: ''})) - } - pc.ontrack = function (event) { + console.log('got track',event.track); if (event.track.kind === 'audio') { return } @@ -43,6 +34,16 @@ let conn = new WebSocket('wss://' + window.location.host + window.location.pathname + '/ws/') window.conn = conn + window.seekClick = () => { + conn.send(JSON.stringify({event: 'seek', data: document.getElementById('seekTime').value})) + } + window.playClick = () => { + conn.send(JSON.stringify({event: 'play', data: ''})) + } + window.pauseClick = () => { + conn.send(JSON.stringify({event: 'pause', data: ''})) + } + conn.onopen = () => { console.log('Connection opened') } diff --git a/main.go b/main.go index 1b862b6..a4afd9b 100644 --- a/main.go +++ b/main.go @@ -58,7 +58,7 @@ func main() { } log.Println("Initializing WebRTC tracks") - videoTrack, err = pc.NewTrack(webrtc.DefaultPayloadTypeH264, 5000, "sync", "sync") + videoTrack, err = pc.NewTrack(webrtc.DefaultPayloadTypeVP8, 5000, "sync", "sync") if err != nil { log.Fatal(err) } -- cgit v1.2.3