Skip to content

Commit

Permalink
Add command send method; call create stream in a lock queue
Browse files Browse the repository at this point in the history
  • Loading branch information
levs42 committed Mar 18, 2024
1 parent e2bee16 commit b31b6d5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Sources/RTMP/RTMPStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@ open class RTMPStream: IOStream {
}
}

/// Sends a command to the RTMP client or server.
public func send(commandName: String, arguments: Any?...) {
connection?.call(commandName, responder: nil, arguments: arguments)
}

/// Creates flv metadata for a stream.
open func makeMetaData() -> ASObject {
var metadata: [String: Any] = [:]
Expand Down Expand Up @@ -548,7 +553,9 @@ open class RTMPStream: IOStream {
switch code {
case RTMPConnection.Code.connectSuccess.rawValue:
readyState = .initialized
connection.createStream(self)
lockQueue.async {
connection.createStream(self)
}
case RTMPStream.Code.playReset.rawValue:
readyState = .play
case RTMPStream.Code.playStart.rawValue:
Expand Down

0 comments on commit b31b6d5

Please sign in to comment.