Skip to content

Commit

Permalink
Merge pull request #21 from mbattista/dev
Browse files Browse the repository at this point in the history
update to pion v3
  • Loading branch information
m1k1o authored Feb 15, 2021
2 parents 00a785f + 56b1aa9 commit 1834186
Show file tree
Hide file tree
Showing 18 changed files with 535 additions and 385 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ This app uses Web RTC to stream a desktop inside of a docker container. This is
- Added RTMP broadcast. Enables broadcasting neko screen to local RTMP server, YouTube or Twitch.
- Stereo sound (works properly only in Firefox host).
- Added limited support for some mobile browsers with `playsinline` attribute.
- Added `VIDEO_BITRATE` and `AUDIO_BITRATE` in kbit/s to control stream quality (in collaboration with @mbattista).
- Added `MAX_FPS`, where you can specify max WebRTC frame rate. When set to `0`, frame rate won't be capped and you can enjoy your real `60fps` experience. Originally, it was constant at `25fps`.

### Bugs
- Fixed minor gst pipeline bug.
- Locked screen only for users, admins can still join.
- Fixed h264 pipelines bugs (by @mbattista).
- Fixed sessions manager thread safety by adding mutexes (caused panic in rare edge cases).

### Misc
- Custom docker workflow.
Expand All @@ -42,6 +45,7 @@ This app uses Web RTC to stream a desktop inside of a docker container. This is
- No pointer events for notify bars.
- Disable debug mode by default.
- Remove HTML tags from user name.
- Upgraded `pion/webrtc` to v3 (by @mbattista).

# Getting started & FAQ

Expand Down
11 changes: 10 additions & 1 deletion client/src/neko/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import EventEmitter from 'eventemitter3'
import { OPCODE } from './data'
import { EVENT, WebSocketEvents } from './events'

import { WebSocketMessages, WebSocketPayloads, SignalProvidePayload } from './messages'
import { WebSocketMessages, WebSocketPayloads, SignalProvidePayload, SignalCandidatePayload } from './messages'

export interface BaseEvents {
info: (...message: any[]) => void
Expand Down Expand Up @@ -246,6 +246,15 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
this.createPeer(sdp, lite, ice)
return
}
if (event === EVENT.SIGNAL.CANDIDATE) {
const { data } = payload as SignalCandidatePayload
let candidate: RTCIceCandidate = JSON.parse(data)
this._peer!.addIceCandidate(candidate)

return
}



// @ts-ignore
if (typeof this[event] === 'function') {
Expand Down
3 changes: 2 additions & 1 deletion client/src/neko/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const EVENT = {
SIGNAL: {
ANSWER: 'signal/answer',
PROVIDE: 'signal/provide',
CANDIDATE: 'signal/candidate',
},
MEMBER: {
LIST: 'member/list',
Expand Down Expand Up @@ -78,7 +79,7 @@ export type ControlEvents =

export type SystemEvents = typeof EVENT.SYSTEM.DISCONNECT
export type MemberEvents = typeof EVENT.MEMBER.LIST | typeof EVENT.MEMBER.CONNECTED | typeof EVENT.MEMBER.DISCONNECTED
export type SignalEvents = typeof EVENT.SIGNAL.ANSWER | typeof EVENT.SIGNAL.PROVIDE
export type SignalEvents = typeof EVENT.SIGNAL.ANSWER | typeof EVENT.SIGNAL.PROVIDE | typeof EVENT.SIGNAL.CANDIDATE
export type ChatEvents = typeof EVENT.CHAT.MESSAGE | typeof EVENT.CHAT.EMOTE
export type ScreenEvents = typeof EVENT.SCREEN.CONFIGURATIONS | typeof EVENT.SCREEN.RESOLUTION | typeof EVENT.SCREEN.SET

Expand Down
10 changes: 10 additions & 0 deletions client/src/neko/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type WebSocketMessages =
| WebSocketMessage
| SignalProvideMessage
| SignalAnswerMessage
| SignalCandidateMessage
| MemberListMessage
| MemberConnectMessage
| MemberDisconnectMessage
Expand All @@ -26,6 +27,7 @@ export type WebSocketMessages =
export type WebSocketPayloads =
| SignalProvidePayload
| SignalAnswerPayload
| SignalCandidatePayload
| MemberListPayload
| Member
| ControlPayload
Expand Down Expand Up @@ -78,6 +80,14 @@ export interface SignalAnswerPayload {
displayname: string
}

// signal/candidate
export interface SignalCandidateMessage extends WebSocketMessage, SignalCandidatePayload {
event: typeof EVENT.SIGNAL.CANDIDATE
}
export interface SignalCandidatePayload {
data: string
}

/*
MEMBER MESSAGES/PAYLOADS
*/
Expand Down
43 changes: 20 additions & 23 deletions server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,30 @@ module n.eko.moe/neko
go 1.13

require (
github.com/coreos/go-etcd v2.0.0+incompatible // indirect
github.com/cpuguy83/go-md2man v1.0.10 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-chi/chi v4.1.0+incompatible
github.com/golang/protobuf v1.3.5 // indirect
github.com/go-chi/chi v4.1.2+incompatible
github.com/google/uuid v1.2.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20210202160940-bed99a852dfe // indirect
github.com/gorilla/websocket v1.4.2
github.com/kataras/go-events v0.0.2
github.com/lucas-clemente/quic-go v0.15.2 // indirect
github.com/mitchellh/mapstructure v1.2.2 // indirect
github.com/pelletier/go-toml v1.7.0 // indirect
github.com/pion/ice v0.7.12 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/magiconair/properties v1.8.4 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/pelletier/go-toml v1.8.1 // indirect
github.com/pion/interceptor v0.0.9
github.com/pion/logging v0.2.2
github.com/pion/rtp v1.4.0 // indirect
github.com/pion/sdp/v2 v2.3.5 // indirect
github.com/pion/turn v1.4.0 // indirect
github.com/pion/webrtc/v2 v2.2.4
github.com/pion/rtcp v1.2.6
github.com/pion/webrtc/v3 v3.0.8
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.18.0
github.com/spf13/afero v1.2.2 // indirect
github.com/rs/zerolog v1.20.0
github.com/smartystreets/assertions v1.2.0 // indirect
github.com/spf13/afero v1.5.1 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cobra v0.0.7
github.com/spf13/cobra v1.1.3
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.6.2
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 // indirect
golang.org/x/crypto v0.0.0-20200403201458-baeed622b8d8 // indirect
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d // indirect
golang.org/x/text v0.3.2 // indirect
gopkg.in/ini.v1 v1.55.0 // indirect
github.com/spf13/viper v1.7.1
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect
golang.org/x/text v0.3.5 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Loading

0 comments on commit 1834186

Please sign in to comment.