Skip to content

Commit

Permalink
Added method to disconnect in example app
Browse files Browse the repository at this point in the history
  • Loading branch information
gredajustyna committed Aug 5, 2024
1 parent 624687c commit be25cc6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions examples/ios/iOSExample/iOSExample/WHEPPlayerViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@ class WHEPPlayerViewModel: ObservableObject, WHEPPlayerListener {
func connect() async throws {
try await player?.connect()
}

func disconnect() {
player?.disconnect()
}
}

4 changes: 4 additions & 0 deletions examples/ios/iOSExample/iOSExample/WHIPPlayerViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ class WHIPPlayerViewModel: ObservableObject, WHIPPlayerListener {
func connect() async throws {
try await player?.connect()
}

func disconnect() {
player?.disconnect()
}
}
4 changes: 2 additions & 2 deletions packages/ios-client/Sources/ios-client/WHEPPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protocol WHEPPlayer {
var isConnectionSetUp: Bool { get set }

func connect() async throws
func closeConnection()
func disconnect()
}

@available(macOS 12.0, *)
Expand Down Expand Up @@ -201,7 +201,7 @@ public class WHEPClientPlayer: NSObject, WHEPPlayer, RTCPeerConnectionDelegate,
- Throws: `SessionNetworkError.ConfigurationError` if the `stunServerUrl` parameter
of the initial configuration is incorrect, which leads to `peerConnection` being nil or in any other case where there has been an error in creating the `peerConnection`
*/
public func closeConnection() {
public func disconnect() {
peerConnection?.close()
peerConnection = nil
DispatchQueue.main.async {
Expand Down
4 changes: 2 additions & 2 deletions packages/ios-client/Sources/ios-client/WHIPPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protocol WHIPPlayer {
var delegate: WHIPPlayerListener? { get set }

func connect() async throws
func closeConnection()
func disconnect()
}

public class WHIPClientPlayer: NSObject, WHIPPlayer, ObservableObject, RTCPeerConnectionDelegate,
Expand Down Expand Up @@ -219,7 +219,7 @@ public class WHIPClientPlayer: NSObject, WHIPPlayer, ObservableObject, RTCPeerCo
- Throws: `SessionNetworkError.ConfigurationError` if the `stunServerUrl` parameter
of the initial configuration is incorrect, which leads to `peerConnection` being nil or in any other case where there has been an error in creating the `peerConnection`
*/
public func closeConnection() {
public func disconnect() {
peerConnection?.close()
peerConnection = nil
DispatchQueue.main.async {
Expand Down

0 comments on commit be25cc6

Please sign in to comment.