cdnbye 0.6.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 78

English | 简体中文

cdnbye logo

Live/VOD P2P Engine for Flutter

pub

Features #

  • Support iOS and Android platform
  • Support live and VOD streams over HLS protocol(m3u8)
  • Support encrypted HLS stream
  • Support cache to avoid repeating the download of TS file
  • Very easy to integrate with an existing flutter project
  • Support any flutter player
  • Efficient scheduling policies to enhance the performance of P2P streaming
  • Highly configurable
  • Use IP database to group up peers by ISP and regions

Screenshot #

Environment Configuration #

See documentation

Example #

import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
import 'package:cdnbye/cdnbye.dart';

// Init p2p engine
_initEngine();

// Start playing video
_loadVideo();

_initEngine() async {
    await Cdnbye.init(
      YOUR_TOKEN,
      config: P2pConfig.byDefault()
    );
}

_loadVideo() async {
    var url = YOUR_STREAM_URL;
    url = await Cdnbye.parseStreamURL(url);           // Parse your stream url
    player = VideoPlayerController.network(url);
    player.play();
}

Example using ijk_player. #

cdnbye_ijk_example

Obtain Token #

See here

Consloe #

Register your AppId at https://oms.cdnbye.com, where you can view p2p-related information.

Issue & Feature Request #

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.

FAQ #

We have collected some frequently asked questions. Before reporting an issue, please search if the FAQ has the answer to your problem.

Contact Us #

Email:service@cdnbye.com

0.6.0 #

解决了安卓不能以新形式注册依赖的问题,完全移除了旧的依赖注册方式,旧版flutter将无法继续使用

0.5.0 #

Update SDK version: iOS(1.0.0) Android(1.2.4) Fix bug: can't listen value changed in flutter.

0.3.0 #

Add new APIs

0.2.0 #

Update Android native SDK to 0.6.2

0.1.0 #

Formal release

example/lib/main.dart

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) {
    print('222,$info');
    // 写入消息
    CdnByeListener().videoInfo.value = info;
  }

  @override
  void initState() {
    // 初始化
    // Future.delayed(Duration.zero).then((_) async {
    Cdnbye.init(
      'free', // replace with your token
      config: P2pConfig(
        logLevel: P2pLogLevel.debug,
      ),
      infoListener: _listen,
    );
    // });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Video Demo',
      theme: ThemeData(
        scaffoldBackgroundColor: Color(0xFFf5f5f4),
      ),
      home: VideoList(),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  cdnbye: ^0.6.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:cdnbye/cdnbye.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
61
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
78
Learn more about scoring.

We analyzed this package on Jun 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.2
  • pana: 0.13.8-dev
  • Flutter: 1.17.1

Maintenance suggestions

The description is too long. (-10 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test