cdnbye 1.3.0 cdnbye: ^1.3.0 copied to clipboard
CDNBye flutter P2P Engine scales live/vod video streaming by peer-to-peer network using bittorrent-like protocol. Powered by WebRTC Datachannel, this SDK can interconnect with the Web side plug-in of [...]
import 'package:cdnbye_example/global/cdnByeListener.dart';
import 'package:cdnbye_example/pages/videoList.dart';
import 'package:cdnbye_example/pages/videoPage.dart';
import 'package:flutter/material.dart';
import 'package:cdnbye/cdnbye.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
_listen(Map info) {
// 写入消息
CdnByeListener().videoInfo.value = info;
}
@override
void initState() {
// 初始化
Cdnbye.init(
'ZMuO5qHZg', // replace with your token
config: P2pConfig(
logLevel: P2pLogLevel.none,
),
infoListener: _listen,
bufferedDurationGeneratorEnable: true,
);
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Video Demo',
theme: ThemeData(
scaffoldBackgroundColor: Color(0xFFf5f5f4),
),
home: VideoList(),
);
}
}