Live video broadcasting, viewing, and stream management components
UIKit Component: Livestream components are built on top of the social.plus SDK, providing ready-to-use live video broadcasting and viewing UI with full data management handled automatically.
The Livestream feature in social.plus UIKit v4 empowers users to broadcast and engage with live video content seamlessly. It provides a suite of components designed to facilitate the creation, viewing, and management of live streams within your application, offering comprehensive tools for both content creators and viewers.
Live stream creation and broadcasting setupStream Creation components enable users to set up and broadcast live video content with comprehensive controls for targeting, customization, and real-time management.
The target selection page allows users to choose where their live stream will be broadcasted - either to a specific community or their personal timeline.
Live stream viewing and playback interfacesStream Viewing components provide comprehensive interfaces for watching live broadcasts and playing back recorded streams with interactive features and controls.
The player page provides viewers with the interface to watch live or recorded streams, supporting real-time viewing and playback of previously ended streams.
// Handle livestream player navigationfunc handleLivestreamPlayerNavigation() { // Player navigation typically handled internally // Custom actions can be implemented for stream end, errors, etc.}func handleStreamEnd() { // Navigate back or to stream summary navigationController?.popViewController(animated: true)}func handleStreamError(error: Error) { // Show error alert and navigate back let alert = UIAlertController( title: "Stream Error", message: error.localizedDescription, preferredStyle: .alert ) alert.addAction(UIAlertAction(title: "OK", style: .default) { _ in self.navigationController?.popViewController(animated: true) }) present(alert, animated: true)}
Stream termination, moderation, and administrative controlsStream Management components handle the administrative aspects of live streaming, including stream termination, moderation actions, and post-stream workflows.
The terminated page is displayed when a live stream ends, either by the host or due to moderation actions, providing appropriate messaging and next steps.
// Handle post-termination navigationfunc handleStreamTerminationActions(action: StreamTerminationAction) { switch action { case .restart: // Navigate to new stream creation let targetSelectionPage = AmityLivestreamPostTargetSelectionPage() let viewController = AmitySwiftUIHostingController(rootView: targetSelectionPage) navigationController?.pushViewController(viewController, animated: true) case .viewRecording: // Navigate to recorded stream if available if let recordedPost = getRecordedStream() { let playerPage = AmityLivestreamPlayerPage(post: recordedPost) let viewController = AmitySwiftUIHostingController(rootView: playerPage) navigationController?.pushViewController(viewController, animated: true) } case .returnToFeed: // Navigate back to main feed navigationController?.popToRootViewController(animated: true) }}
Implementation Strategy: Start with the Livestream Target Selection Page to establish audience targeting workflows, then implement the Creation Page for stream setup and broadcasting controls. Add the Player Page for viewer experiences and ensure proper termination handling with the Terminated Page. Consider implementing real-time moderation features for live content safety and provide clear navigation flows between stream creation, viewing, and post-stream actions. Focus on optimizing streaming quality and providing responsive controls for both broadcasters and viewers.