auro_stream_live 1.0.6
auro_stream_live: ^1.0.6 copied to clipboard
Auro Stream Live Stream Plugin for iOS/Android/Desktop
AuroStream Live SDK #
AuroStream Live SDK enables developers to seamlessly integrate real-time live streaming and interactive features into their applications. It provides functionality for managing live sessions, handling user roles (broadcasters and viewers), toggling media streams (audio/video), and more, all through WebSocket communication.
Features #
- Real-Time Live Streaming: Easily initiate and manage live streams.
- Multi-Role Support: Manage different user roles (e.g., host, guest, viewers) with role-based controls.
- Audio/Video Control: Toggle audio and video streams, switch between front and back cameras, and handle microphone and camera status.
- Interactive Features: Add/remove guests, send and receive comments, and handle user presence in real time.
- Error Handling and UI Updates: Built-in error handling mechanisms with customizable callbacks for network reconnection and UI updates.
- Scalable Architecture: Use WebSocket-based architecture for real-time communication.
Installation #
To add AuroStream Live SDK to your project, update your pubspec.yaml
file:
dependencies:
auro_stream_live: ^0.0.1
Then, run the following command to fetch the package:
dart pub get
Usage #
1. Initialize the SDK #
Before using any features, initialize the SDK with your projectId
and apiKey
.
import 'package:auro_stream_live/auro_stream_live.dart';
void main() {
AuroStreamLive.initialize(
projectId: 'your_project_id',
apiKey: 'your_api_key',
);
}
2. Connect to the Server #
You need to connect to the server before starting a live session.
AuroStreamLive.instance.connectServer(
whenConnect: () {
print('Connected to the server.');
},
whenDisconnect: () {
print('Disconnected from the server.');
},
whenConnectError: (error) {
print('Connection error: $error');
},
whenReconnect: (data) {
print('Reconnected: $data');
},
whenReconnectError: (error) {
print('Reconnection error: $error');
},
);
3. Starting and Managing a Live Session #
To start a live session, you can call:
AuroStreamLive.instance.startLive(
username: 'your_username',
);
You can end a live session using:
AuroStreamLive.instance.endLive(sessionKey: 'your_session_key');
4. Guest Management #
Add a guest to your live session:
AuroStreamLive.instance.addGuestToLive(
sessionKey: 'your_session_key',
userId: 'guest_user_id',
);
Remove a guest from the live session:
AuroStreamLive.instance.removeGuestFromLive(
sessionKey: 'your_session_key',
userId: 'guest_user_id',
);
5. Handling Audio and Video #
Turn the microphone on or off:
AuroStreamLive.instance.micON(
sessionKey: 'your_session_key',
username: 'your_username',
);
AuroStreamLive.instance.micOFF(
sessionKey: 'your_session_key',
username: 'your_username',
);
Turn the video camera on or off:
AuroStreamLive.instance.videoCamON(
sessionKey: 'your_session_key',
username: 'your_username',
);
AuroStreamLive.instance.videoCamOFF(
sessionKey: 'your_session_key',
username: 'your_username',
);
Switch between the front and back camera:
AuroStreamLive.instance.switchCamera(
sessionKey: 'your_session_key',
);
6. Receiving Comments #
To listen for incoming comments:
AuroStreamLive.instance.onReceiveCommentListener(
whenReceiveComment: (feedback, comment) {
print('Received comment: $comment');
},
);
7. Error Handling and UI Updates #
You can handle network disconnection and reconnection with customizable callbacks:
AuroStreamLive.instance.initFunctions(
handleNetworkReconnectionFunction: () {
print('Reconnected to the network.');
},
handleNetworkDisconnectionFunction: () {
print('Disconnected from the network.');
},
updateUiFunction: () {
// Custom UI update logic
},
whenInitMediaFunction: () {
// Initialize media-related UI components
},
whenNoAudioTrackFunction: () {
print('No audio track available.');
},
whenNoVideoTrackFunction: () {
print('No video track available.');
},
);
Full API Documentation #
For more detailed information, including the full list of available methods and event handlers, check the official API Documentation.
License #
This package is licensed under the MIT License. See the LICENSE file for more details.