From a00ae567375222a8afa65579ac0290ff1ebe6b26 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 21 Jun 2020 17:40:38 +0000 Subject: move HTML+JS to separate file I got fed up with rebuilding every time I changed something; plus, syntax highlight is easier this way --- index.html | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ main.go | 75 ------------------------------------------------------------- 2 files changed, 76 insertions(+), 75 deletions(-) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..ab9b120 --- /dev/null +++ b/index.html @@ -0,0 +1,76 @@ + + + + + synced-playback + + + + +
+ + + + +
+ + + + diff --git a/main.go b/main.go index 947fad0..42c8fbf 100644 --- a/main.go +++ b/main.go @@ -13,75 +13,6 @@ import ( "github.com/pion/webrtc/v2" ) -const homeHTML = ` - - - synced-playback - - - - -
- - - - -
- - - - -` - var ( upgrader = websocket.Upgrader{ ReadBufferSize: 1024, @@ -138,7 +69,6 @@ func main() { pipeline = gst.CreatePipeline(containerPath, audioTrack, videoTrack) pipeline.Start() - http.HandleFunc(httpPath, serveHome) http.HandleFunc(httpPath + "/ws/", serveWs) fmt.Println(fmt.Sprintf("Video file '%s' is now available on '%s', have fun!", containerPath, httpListenAddress)) @@ -236,8 +166,3 @@ func serveWs(w http.ResponseWriter, r *http.Request) { } } } - -func serveHome(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "text/html; charset=utf-8") - fmt.Fprintf(w, homeHTML) -} -- cgit v1.2.3