Remove old is_mobile init param

This commit is contained in:
Sergy Stepanov 2021-07-31 12:33:25 +03:00
parent f7790732f5
commit a3d2549028
5 changed files with 4 additions and 25 deletions

View file

@ -25,7 +25,6 @@ const (
type GameStartRequest struct {
GameName string `json:"game_name"`
IsMobile bool `json:"is_mobile"`
}
func (packet *GameStartRequest) From(data string) error { return from(packet, data) }

View file

@ -100,7 +100,7 @@ func (w *WebRTC) WithConfig(conf webrtcConfig.Config) *WebRTC {
}
// StartClient start webrtc
func (w *WebRTC) StartClient(isMobile bool, iceCB OnIceCallback) (string, error) {
func (w *WebRTC) StartClient(iceCB OnIceCallback) (string, error) {
defer func() {
if err := recover(); err != nil {
log.Println(err)

View file

@ -1,7 +1,6 @@
package worker
import (
"encoding/json"
"log"
"strconv"
@ -46,17 +45,8 @@ func (h *Handler) handleInitWebrtc() cws.PacketHandler {
peerconnection := webrtc.NewWebRTC().WithConfig(
webrtcConfig.Config{Encoder: h.cfg.Encoder, Webrtc: h.cfg.Webrtc},
)
var initPacket struct {
IsMobile bool `json:"is_mobile"`
}
err := json.Unmarshal([]byte(resp.Data), &initPacket)
if err != nil {
log.Println("Error: Cannot decode json:", err)
return cws.EmptyPacket
}
localSession, err := peerconnection.StartClient(
initPacket.IsMobile,
// send back candidate string to browser
func(cd string) { h.oClient.Send(api.IceCandidatePacket(cd, resp.SessionID), nil) },
)
@ -76,10 +66,7 @@ func (h *Handler) handleInitWebrtc() cws.PacketHandler {
return cws.EmptyPacket
}
return cws.WSPacket{
ID: "offer",
Data: localSession,
}
return cws.WSPacket{ID: "offer", Data: localSession}
}
}

View file

@ -45,10 +45,7 @@ const rtcp = (() => {
mediaStream.addTrack(event.track);
}
socket.send({
'id': 'init_webrtc',
'data': JSON.stringify({'is_mobile': env.isMobileDevice()}),
});
socket.send({'id': 'init_webrtc'});
};
async function addVoiceStream(connection) {
@ -67,10 +64,7 @@ const rtcp = (() => {
log.info(e)
} finally {
socket.send({
'id': 'init_webrtc',
'data': JSON.stringify({'is_mobile': env.isMobileDevice()}),
});
socket.send({'id': 'init_webrtc'});
}
}

View file

@ -125,7 +125,6 @@ const socket = (() => {
"id": "start",
"data": JSON.stringify({
"game_name": gameName,
"is_mobile": isMobile
}),
"room_id": roomId != null ? roomId : '',
"player_index": playerIndex