Comments (2)
we need something like this but where i should do it
struct CreateVideoRoom: Codable {
struct Body: Codable {
let request, description: String
let room, bitrate, publishers: Int
let secret: String
let firFreq: Int
let audiocodec, videocodec: String
let record: Bool
enum CodingKeys: String, CodingKey {
case request, description, room, bitrate, publishers, secret
case firFreq = "fir_freq"
case audiocodec, videocodec, record
}
}
let janus: String
let body: Body
let transaction, sessionID, handleID: String
enum CodingKeys: String, CodingKey {
case janus, body, transaction
case sessionID = "session_id"
case handleID = "handle_id"
}
}```
from januswebrtc.
i figuare out how it will be work but i have to check how it will check its join or create type -> delegate.type
class CreateCommand: BaseCommand {
override func receive(strData: String) {
print("CreateCommand 82")
guard let data = CreateData.decode(json: strData, using: .utf8) else {
print("missing CreateData data 53")
return
}
delegate.setSessionId( data.data.id)
delegate.sendCommand(command: AttachCommand(delegate: delegate, handleID: 0))
}
override func getDataObject() -> [String : Any] {
return ["janus": "create", "transaction": transaction] as [String : Any]
}
}
class CreateRoomCommand: BaseCommand {
override func receive(strData: String) {
print("CreateCommand 82, session", delegate.sessionID)
guard let data = CreateVideoRoom.decode(json: strData, using: .utf8) else {
print("missing CreateData data 104")
return
}
handleID = data.handleID.id
delegate.sendCommand(command: AttachCommand(delegate: delegate, handleID: handleID))
}
override func getDataObject() -> [String : Any] {
let body = [
"request": "create",
"description": "Awesome Room :)",
"room": delegate.roomID,
"bitrate": 0,
"is_private": true,
"secret": "adminpwd",
"firFreq": 10,
"audiocodec": "opus",
"videocodec": "vp8",
"record": false
] as [String: Any]
return [
"janus": "message",
"transaction": transaction,
"body": body,
"session_id": delegate.sessionID,
"handle_id": handleID
] as [String : Any]
}
}
class AttachCommand: BaseCommand {
override func receive(strData: String) {
print("AttachCommand 103")
guard let data = AttachData.decode(json: strData, using: .utf8) else {
print("missing AttachData data 71")
return
}
handleID = data.data.id
if delegate.type == .create {
delegate.sendCommand(command: CreateRoomCommand(delegate: delegate, handleID: handleID))
}
if delegate.type == .listParticipants {
delegate.sendCommand(command: ListparticipantsCommand(delegate: delegate, handleID: handleID))
} else {
if preData == nil {
delegate.sendCommand(command: JoinForPublisherCommand(delegate: delegate, handleID: handleID))
} else {
delegate.sendCommand(command: JoinForSubscriberCommand(delegate: delegate, handleID: handleID, data: preData))
}
}
}
override func getDataObject() -> [String : Any] {
return [
"janus": "attach",
"transaction": transaction,
"session_id": delegate.sessionID,
"plugin": "janus.plugin.videoroom",
"opaque_id": "videoroomtest-"
] as [String : Any]
}
}
I fixed this way but don't know how good is it
inside RTCVideoServer
i make it like this var type: JanusType = .create i add my enum create
from januswebrtc.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from januswebrtc.