P2P Streaming Engine

vuePress-theme-reco    2018 - 2021
P2P Streaming Engine P2P Streaming Engine

Choose mode

  • dark
  • auto
  • light
Documents
  • Introduction
  • Web SDK

    • Hls.js
    • Dash.js
    • Shaka-Player
    • MP4
    • Downloader
  • Android SDK
  • iOS SDK
  • Flutter SDK
Pricing
Contact Us
Partnership
Console
GitHub
语言
  • English
  • 简体中文

Documents
  • Introduction
  • Web SDK

    • Hls.js
    • Dash.js
    • Shaka-Player
    • MP4
    • Downloader
  • Android SDK
  • iOS SDK
  • Flutter SDK
Pricing
Contact Us
Partnership
Console
GitHub
语言
  • English
  • 简体中文
  • Introduction
  • FAQ
  • Tracking Service
  • Signaling Service
  • P2P Optimization
  • Console

    • Domain/AppId Binding
    • Data Analysis
    • P2P Control
    • Restful API
  • Hls.js SDK

    • Introduction
    • Usage
    • Player Integration
    • API & Config
    • CDN
    • Change Log
  • Android SDK

    • Introduction
    • Usage
    • API & Config
    • Change Log
  • iOS SDK

    • Introduction
    • Usage
    • API & Config
    • Change Log
  • Flutter SDK

    • Introduction
    • Usage
      • API & Config
      • Change Log
    • Shaka-Player SDK

      • Introduction
      • Usage
      • Player Integration
      • API & Config
      • Change Log
    • Web MP4 SDK

      • Introduction
      • Usage
      • Player Integration
      • API & Config
      • Change Log
    • Dash.js SDK

      • Introduction
      • Usage
      • Player Integration
      • API & Config
      • Change Log
    • Web Downloader

      • Introduction
      • Usage
      • API & Config
      • Change Log
    • Android SDK 1.x

      • Introduction
      • Usage
      • API & Config
      • Change Log
    • More

      • Design

    Usage

    vuePress-theme-reco    2018 - 2021

    Usage


    # Installation

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

    dependencies:
      cdnbye: ^0.8.1
    

    # iOS

    Uncomment # platform :ios, '10.0' at the second line of ios/Podfile in your flutter project.
    In order to allow the loading of distributed content via the local proxy, enable loading data from HTTP in your app by opening your info.plist file as source code and adding the following values below the tag:

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
    

    # Android

    Please set minSdkVersion to 19.
    Add relevant uses permissions in app/src/main/AndroidManifest.xml:

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    

    Starting with Android 9 (API level 28), cleartext support is disabled by default. There are 2 solutions:
    (1) set targetSdkVersion under 27
    (2) Add the attribute below in app/src/main/AndroidManifest.xml to indicate that the app intends to use cleartext HTTP:

    <application
      ...
      android:usesCleartextTraffic="true"
      ...
        />
    

    # 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);
    }
    

    # Example using ijk_player

    cdnbye_ijk_example