From 154efbbabe3fb6e5138dab893d719d4c703be166 Mon Sep 17 00:00:00 2001 From: Najam Sikander Awan Date: Thu, 28 Feb 2019 12:10:28 +0500 Subject: [PATCH] main.go boxutil package has x into its path which is not found on filesystem for that go was throwing errors. removed x to build script. assets/app.js script to create media stream was using old api. wrap that code in try block. if modern browser throws exception use new api otherwise keep using old api call. --- assets/app.js | 18 +++++++++++++++--- main.go | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/assets/app.js b/assets/app.js index 9664af5..ad947ac 100644 --- a/assets/app.js +++ b/assets/app.js @@ -1,9 +1,20 @@ $(function(){ + console.log("bublo will run this code"); var video = document.getElementById('video'); if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { navigator.mediaDevices.getUserMedia({ video: true }).then(function (stream) { - video.src = window.URL.createObjectURL(stream); - video.play(); + try{ + video.src = window.URL.createObjectURL(stream); + //video.srcObject = stream; + //video.play(); + } catch(e){ + console.log("cant play video:"); + console.log(e); + video.srcObject = stream; + video.play(); + + } + }); } @@ -38,7 +49,8 @@ $(function(){ return } if (!resp.matched) { - button.transition("shake") + $('.info.message').text("sorry no match").fadeIn() + // button.transition("shake") return } $('.info.message').text("Hello " + resp.name).fadeIn() diff --git a/main.go b/main.go index 4910d7e..9c98c9a 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,7 @@ import ( "os" "github.com/machinebox/sdk-go/facebox" - "github.com/machinebox/sdk-go/x/boxutil" + "github.com/machinebox/sdk-go/boxutil" ) func main() {