diff --git a/Dockerfile b/Dockerfile
index fb7508dd..01ab6ebf 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -8,7 +8,7 @@ WORKDIR /go/src/github.com/giongto35/cloud-game
RUN apt-get update
#RUN apt-get install portaudio19-dev -y
RUN apt-get install libvpx-dev -y
-RUN go get github.com/pions/webrtc
+RUN go get github.com/pion/webrtc
#RUN go get github.com/gordonklaus/portaudio
RUN go get github.com/gorilla/mux
RUN go get github.com/gorilla/websocket
diff --git a/index_http.html b/index_http.html
index ad7c5adb..4229171e 100644
--- a/index_http.html
+++ b/index_http.html
@@ -25,6 +25,7 @@ textarea {
+
Instruction
@@ -98,8 +99,9 @@ pc.ontrack = function (event) {
var el = document.createElement(event.track.kind)
el.srcObject = event.streams[0]
el.autoplay = true
- // el.controls = true
- // el.poster = new URL("https://orig00.deviantart.net/cdcd/f/2017/276/a/a/october_2nd___gameboy_poltergeist_by_wanyo-dbpdmnd.gif");
+ el.width = 800;
+ el.height = 600;
+ el.poster = new URL("https://orig00.deviantart.net/cdcd/f/2017/276/a/a/october_2nd___gameboy_poltergeist_by_wanyo-dbpdmnd.gif");
document.getElementById('remoteVideos').appendChild(el)
}
diff --git a/index_ws.html b/index_ws.html
index 7774dc16..21bcbe2b 100644
--- a/index_ws.html
+++ b/index_ws.html
@@ -25,7 +25,8 @@ textarea {
-
+
+
Instruction
@@ -137,6 +138,8 @@ window.startGame = () => {
// console.log(event.streams);
el.srcObject = event.streams[0];
el.autoplay = true;
+ el.width = 800;
+ el.height = 600;
el.poster = new URL("https://orig00.deviantart.net/cdcd/f/2017/276/a/a/october_2nd___gameboy_poltergeist_by_wanyo-dbpdmnd.gif");
document.getElementById('remoteVideos').appendChild(el)
diff --git a/main.go b/main.go
index 6f8b27bc..d1248138 100644
--- a/main.go
+++ b/main.go
@@ -1,9 +1,10 @@
package main
import (
- pionRTC "github.com/pions/webrtc"
"os"
+ pionRTC "github.com/pion/webrtc"
+
"fmt"
"image"
"io/ioutil"
@@ -78,7 +79,7 @@ func ws(w http.ResponseWriter, r *http.Request) {
log.Println("New Connection")
webRTC := webrtc.NewWebRTC()
-
+
// streaming game
// start new games and webrtc stuff?
@@ -133,7 +134,7 @@ func ws(w http.ResponseWriter, r *http.Request) {
log.Println("Starting game")
imageChannel := make(chan *image.RGBA, 100)
go screenshotLoop(imageChannel, webRTC)
- go startGame("games/" + gameName, imageChannel, webRTC.InputChannel, webRTC)
+ go startGame("games/"+gameName, imageChannel, webRTC.InputChannel, webRTC)
res.ID = "start"
isDone = true
}
@@ -152,15 +153,11 @@ func ws(w http.ResponseWriter, r *http.Request) {
}
}
-
-
-
type SessionPacket struct {
- Game string `json:"game"`
- SDP string `json:"sdp"`
+ Game string `json:"game"`
+ SDP string `json:"sdp"`
}
-
func postSession(w http.ResponseWriter, r *http.Request) {
bs, err := ioutil.ReadAll(r.Body)
if err != nil {
@@ -185,7 +182,7 @@ func postSession(w http.ResponseWriter, r *http.Request) {
imageChannel := make(chan *image.RGBA, 100)
go screenshotLoop(imageChannel, webRTC)
- go startGame("games/" + postPacket.Game, imageChannel, webRTC.InputChannel, webRTC)
+ go startGame("games/"+postPacket.Game, imageChannel, webRTC.InputChannel, webRTC)
w.Write([]byte(localSession))
}
diff --git a/webrtc/webrtc.go b/webrtc/webrtc.go
index eab138d5..bccf1da0 100644
--- a/webrtc/webrtc.go
+++ b/webrtc/webrtc.go
@@ -13,8 +13,8 @@ import (
"time"
vpxEncoder "github.com/giongto35/cloud-game/vpx-encoder"
- "github.com/pions/webrtc"
- "github.com/pions/webrtc/pkg/media"
+ "github.com/pion/webrtc"
+ "github.com/pion/webrtc/pkg/media"
)
var config = webrtc.Configuration{ICEServers: []webrtc.ICEServer{{URLs: []string{"stun:stun.l.google.com:19302"}}}}
@@ -104,7 +104,7 @@ type WebRTC struct {
connection *webrtc.PeerConnection
encoder *vpxEncoder.VpxEncoder
isConnected bool
- isClosed bool
+ isClosed bool
// for yuvI420 image
ImageChannel chan []byte
InputChannel chan int
@@ -147,7 +147,6 @@ func (w *WebRTC) StartClient(remoteSession string, width, height int) (string, e
return "", err
}
-
// WebRTC state callback
w.connection.OnICEConnectionStateChange(func(connectionState webrtc.ICEConnectionState) {
fmt.Printf("ICE Connection State has changed: %s\n", connectionState.String())
@@ -169,7 +168,6 @@ func (w *WebRTC) StartClient(remoteSession string, width, height int) (string, e
fmt.Println(iceCandidate)
})
-
// Data channel callback
w.connection.OnDataChannel(func(d *webrtc.DataChannel) {
fmt.Printf("New DataChannel %s %d\n", d.Label(), d.ID())