-
Notifications
You must be signed in to change notification settings - Fork 0
Core Live Streaming Stop
Stop the current RTSP or JPEG device live-stream session and release any player, relay, image, or UI resources owned by the host app.
- The target device conforms to
LiveStreamingAPI. - Keep references to presentation resources created for the current session.
- Make stop handling idempotent so view dismissal and an explicit stop action can share the same cleanup path.
AIBuds.xcframework
import AIBuds
import AIBudsLiveStream#import <AIBuds/AIBuds-Swift.h>
#import <AIBuds/AIBuds.h>
#import <AIBudsLiveStream/AIBudsLiveStream-Swift.h>/// Stop live streaming
func stopLiveStreaming()/// Stop live streaming
- (void)stopLiveStreaming;See stopLiveStreaming.
This method has no parameters.
This method does not return a value or accept a completion handler. Observe the sessionFinishHandler supplied when starting the session for terminal context.
The Demo stops an optional RTMP relay before stopping RTSP playback, then clears device-session and UI state. The device command and host resources are separate lifecycles.
func stopCurrentLiveStream() {
// Stop optional host-side relay and playback resources.
liveStreamer?.stopStreaming()
liveStreamer = nil
mediaPlayer?.stop()
// Stop the RTSP or JPEG session on the connected device.
(device as? LiveStreamingAPI)?.stopLiveStreaming()
currentRTSPAddress = nil
imageView.image = nil
setStreamingActive(false)
}- (void)stopCurrentLiveStream {
// Stop optional host-side relay and playback resources.
[self.liveStreamer stopStreaming];
self.liveStreamer = nil;
[self.mediaPlayer stop];
// Stop the RTSP or JPEG session on the connected device.
id<AIBudsLiveStreamingAPI> streamingDevice = (id<AIBudsLiveStreamingAPI>)self.device;
if ([streamingDevice conformsToProtocol:@protocol(AIBudsLiveStreamingAPI)]) {
[streamingDevice stopLiveStreaming];
}
self.currentRtspAddress = nil;
self.imageView.image = nil;
[self setStreamingActive:NO];
}Because stopLiveStreaming() has no completion handler, make local cleanup safe to repeat and use the original session's finish callback to distinguish isUserInitiatedStop from an interruption. Log or present the callback error when a session ends unexpectedly.
- Stop live streaming when leaving the owning screen or ending the feature.
- Release the RTMP relay, player, and retained RTSP address together with the device session.
- Do not wait for a stop completion that the public method does not provide.
- Keep finish-callback handling idempotent because it can run after local cleanup.
- The same stop method ends either an RTSP or JPEG device session.
- Stopping
LiveStreamingPlayeralone does not stop the device session. - Stopping the device session alone does not automatically release host-owned playback or relay objects.
AIBuds SDK documentation · Full documentation · API Reference
- Introduction
- Getting Started
- Core Concepts
-
Core Features
- Basic Features
- Device Info
- Find Device
- Physical Operations
- Work Mode
- Work Status
- Wear Detection
- Volume Control
- Music Control
- TWS
- Equalizer
- ANC
- Audio
- Camera
- Remote Camera
- File Import
- Teleprompter
- Segment Navigation
- Live Streaming
- Device Applications
- OTA
- Camera OTA
- Service Auth
- AI Services
- Voice Assistant
- Logging
- Advanced Topics
- Releases
- Troubleshooting