Skip to content

Commit

Permalink
Merge pull request shogo4405#1524 from shogo4405/feature/deleteStream
Browse files Browse the repository at this point in the history
implementation deleteStream.
  • Loading branch information
shogo4405 authored Jul 29, 2024
2 parents 8dd8abd + 45d109d commit ac7209a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Examples/iOS/Preference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ struct Preference: Sendable {
// Temp
static nonisolated(unsafe) var `default` = Preference()

var uri: String? = "rtmp://192.168.1.4/live"
var uri: String? = "rtmp://192.168.1.6/live"
var streamName: String? = "live"
}
24 changes: 13 additions & 11 deletions Sources/RTMP/RTMPStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -501,18 +501,20 @@ open class RTMPStream: IOStream {
readyState = .open
if let fcPublishName {
connection.call("FCUnpublish", responder: nil, arguments: fcPublishName)
connection.call("deleteStream", responder: nil, arguments: id)
} else {
connection.doOutput(chunk: RTMPChunk(
type: .zero,
streamId: RTMPChunk.StreamID.command.rawValue,
message: RTMPCommandMessage(
streamId: id,
transactionId: 0,
objectEncoding: objectEncoding,
commandName: "closeStream",
commandObject: nil,
arguments: []
)))
}
connection.doOutput(chunk: RTMPChunk(
type: .zero,
streamId: RTMPChunk.StreamID.command.rawValue,
message: RTMPCommandMessage(
streamId: 0,
transactionId: 0,
objectEncoding: self.objectEncoding,
commandName: "closeStream",
commandObject: nil,
arguments: [self.id]
)))
}

func doOutput(_ type: RTMPChunkType, chunkStreamId: UInt16, message: RTMPMessage) {
Expand Down

0 comments on commit ac7209a

Please sign in to comment.