Last updated:
0 purchases
live file publisher
Introduction #
live_file_publisher is a Flutter package that enables you to seamlessly publish your video file to RTSP or RTMP servers within your Flutter applications.
Features #
Publish live video streams to RTSP or RTMP servers.
Easy integration into your Flutter applications.
Installation #
flutter pub add live_file_publisher
copied to clipboard
Usage #
// import the package
import 'package:live_file_publisher/live_file_publisher.dart';
// Initialise
LiveFilePublisher filePublisher = LiveFilePublisher();
// Event callback
@override
void initState() {
super.initState();
filePublisher.addStateListener(onStateListener);
filePublisher.addErrorListener(onErrorListener);
filePublisher.addLogListener(onLogListener);
}
void onStateListener(PublishingState state) {
print(state);
}
void onErrorListener(Object error) {
print(error);
}
void onLogListener(String log) {
print(log)
}
.
.
// Connect
filePublisher.connect(url: 'rtsp://localhost', mode: PublisherProtocol.RTSP_UDP);
// Publish
filePublisher.publish(startTime: '00:00:00',filePath: <filepath>,name: 'mystream');
.
.
// Stop
filePublisher.stop();
copied to clipboard
Enums #
enum PublisherProtocol {
RTMP,
RTSP_UDP,
RTSP_TCP,
}
enum PublishingState {
Normal,
RequestPublish,
Publishing,
RequestStopPublish,
}
copied to clipboard
Example #
Please check the usage of this package in this example project https://github.com/sxudan/lets-watch
License #
This project is licensed under the MIT License - see the LICENSE file for details.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.