qiniu_live 0.0.2+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 40

qiniu_live #

封装了七牛的实时音频的功能,用于一对多的音频直播。通过控制是否时管理员(admin)来控制有多少个主播能发布声音,非管理员用户都为观众,只能听不能说话。 可用于场景:FM电台、聊天室、讲座等。

封装的功能有 #

1. 发布直播间
2. 进入、离开直播间
3. 获取进入、退出直播间人的信息
4. 关闭、打开扬声器
5. 关闭、打开声音

安装方式 #

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

dependencies:
	qiniu_live: ^0.0.2+1
	  
flutter packages get

Getting Started #

Android需要配置xml:

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />

1、发布直播(兼容测试) #

QiniuLive.publishAudio("appId", "roomName","token ", {
  "user_id": "4",
  "avatar_url":
      "http://thirdqq.qlogo.cn/g?b=oidb&k=h22EA0NsicnjEqG4OEcqKyg&s=100",
  "username": "jason1",
  "is_admin": true //true表示主播,false表示观众
});
这里兼容了七牛给的测试链接,如果为测试环境,token为“”,
需要填写七牛给的appId,如果为线上使用则无需填写appId,直接填入token即可。

2、控制扬声器开关(默认打开) #

QiniuLive.speakerOn();

3、控制扬声器开关(默认打开) #

QiniuLive.muteAudio();

4、退出直播间(用户) #

QiniuLive.leaveRoom();

6、关闭直播(主播) #

QiniuLive.unPublish();

7、获取实时出入人数 #

如果你想要实时监控进入房间和退出房间的情况,则可以实现以下通道。

static const EventChannel eventChannel = const EventChannel('qiniu_live_users');

eventChannel
    .receiveBroadcastStream("")
    .listen(_onEvent, onError: _onError);
    
void _onEvent(Object event) {

print("qiniu_live_users:$event");
setState(() {

});
}

0.0.2+1 #

修改了publish track的逻辑

0.0.2 #

  • 稳定版.

0.0.1+3 #

  • 修复android不监听实时人数崩溃的问题.

0.0.1+2 #

  • 修复ios不监听实时人数崩溃的问题.

0.0.1+1 #

  • 修复ios端取消发布的问题.

0.0.1 #

  • 测试版.

example/README.md

qiniu_live_example #

Demonstrates how to use the qiniu_live plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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


dependencies:
  qiniu_live: ^0.0.2+1

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:qiniu_live/qiniu_live.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
50
Overall:
Weighted score of the above. [more]
40
Learn more about scoring.

We analyzed this package on Oct 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

9 out of 9 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/qiniu_live.dart.

Run flutter format to format lib/qiniu_live.dart.

Maintenance issues and suggestions

The description contains too many non-ASCII characters. (-20 points)

The site uses English as its primary language. The value of the description field in your package's pubspec.yaml field should primarily contain characters used in English.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

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