rtmp_tencent_live 0.0.6

  • Readme
  • Changelog
  • Example
  • Installing
  • 55

rtmp_tencent_live #

pub package

腾讯直播flutter插件

有问题欢迎提issues,或者欢迎加入flutter腾讯直播,群聊号码:1128573542

安装 #

在工程 pubspec.yaml 中加入 dependencies

dependencies:
  rtmp_tencent_live:
    git:
      url: https://github.com/zhengzhuang96/rtmp_tencent_live.git
      ref: master
  • pub 集成
dependencies:
  rtmp_tencent_live: ^0.0.6

导入 #

import 'package:rtmp_tencent_live/rtmp_tencent_live.dart';

注册license #

void main() async {
  await TencentLive.instance.init(
      licenseUrl: 'http://******.licence', 
      licenseKey: '******'
  );
}

页面中显示直播 #

import 'package:rtmp_tencent_live/rtmp_tencent_live.dart';
import 'package:rtmp_tencent_live/tencent_live_push_Controller.dart';

TencentLivePushController _controller;

TencentLive(
    rtmpURL: "",        /// 推流链接
    onCreated: (controller) {
        _controller = controller;
    }
)

使用命令 #

支持度使用方法介绍
开始直播startLive()
翻转摄像头setSwitchCamera()
打开后置灯光setTurnOnFlashLight()只有在后置摄像头状态才可用
镜像模式setMirror()用户端显示状况
磨皮setDermabrasion(v.toInt())v: 磨皮级别:0-9,0:关闭,9最大
美白setWhitening(v.toInt())v: 美白级别:0-9,0:关闭,9最大
红润setUpRuddy(v.toInt())v: 红润级别:0-9,0:关闭,9最大

0.0.1 #

  • TODO: Describe initial release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:rtmp_tencent_live/rtmp_tencent_live.dart';
import 'package:rtmp_tencent_live/tencent_live_push_Controller.dart';

void main() async {
  runApp(MyApp());
  await TencentLive.instance.init(
      licenseUrl: 'http://license.vod2.myqcloud.com/license/v1/a062c6677c9e5273ee05e7df6f087810/TXLiveSDK.licence',
      licenseKey: '5bf89b2c4cf8ab1ca33a36ff20137071'
  );
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: LivePage(),
    );
  }
}

class LivePage extends StatefulWidget {
  @override
  _LivePageState createState() => _LivePageState();
}

class _LivePageState extends State<LivePage> {
  TencentLivePushController _controller;

  double value = 0;
  double value2 = 0;
  double value3 = 0;
  double value4 = 0;

  /// 按钮组建
  Widget _buttonList(Icon icons, String title, Function onClick) {
    return InkWell(
      child: Container(
        color: Color.fromARGB(100, 255, 255, 255),
        child: Column(
          children: <Widget>[
            icons,
            Text('$title'),
          ],
        ),
      ),
      onTap: onClick,
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        width: MediaQuery.of(context).size.width,
        height: MediaQuery.of(context).size.height,
        child: Stack(
          children: <Widget>[
            TencentLiveView(
              rtmpURL: "rtmp://100747.livepush.myqcloud.com/live/1?txSecret=f6135a64dd82463bbeb8e7e0f1cb8305&txTime=5F0AB236",
              onCreated: (controller) {
                _controller = controller;
              }
            ),
            Positioned(
              top: 0,
              left: 0,
              child: Container(
                width: MediaQuery.of(context).size.width,
                height: MediaQuery.of(context).size.height,
//                color: Colors.amber,
                child: SafeArea(
                    child: Stack(
                      children: <Widget>[
                        Text('data'),
                        Positioned(
                          top: 0,
                          left: 0,
                          child: Container(
                            padding: EdgeInsets.only(
                              left: 20.0,
                              right: 20.0,
                              bottom: 20.0,
                              top: 20.0,
                            ),
                            width: MediaQuery.of(context).size.width,
                            child: Column(
                              children: <Widget>[
                                Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceAround,
                                  children: <Widget>[
                                    _buttonList(Icon(Icons.ac_unit), '翻转', () {
                                      _controller.setSwitchCamera();
                                    }),
                                    _buttonList(Icon(Icons.ac_unit), '打开后置灯光', () {
                                      _controller.setTurnOnFlashLight();
                                    }),
                                    _buttonList(Icon(Icons.ac_unit), '镜像模式', () {
                                      _controller.setMirror();
                                    }),
                                  ],
                                ),
                                Text('磨皮'),
                                SliderTheme( //自定义风格
                                  data: SliderTheme.of(context).copyWith(
                                      activeTrackColor: Colors.pink, //进度条滑块左边颜色
                                      inactiveTrackColor: Colors.blue, //进度条滑块右边颜色
                                      thumbColor: Colors.yellow, //滑块颜色
                                      overlayColor: Colors.green, //滑块拖拽时外圈的颜色
                                      overlayShape: RoundSliderOverlayShape(//可继承SliderComponentShape自定义形状
                                        overlayRadius: 25, //滑块外圈大小
                                      ),
                                      thumbShape: RoundSliderThumbShape(//可继承SliderComponentShape自定义形状
                                        disabledThumbRadius: 15, //禁用是滑块大小
                                        enabledThumbRadius: 15, //滑块大小
                                      ),
                                      inactiveTickMarkColor: Colors.black,
                                      tickMarkShape: RoundSliderTickMarkShape(//继承SliderTickMarkShape可自定义刻度形状
                                        tickMarkRadius: 4.0,//刻度大小
                                      ),
                                      showValueIndicator: ShowValueIndicator.onlyForDiscrete,//气泡显示的形式
                                      valueIndicatorColor: Colors.red,//气泡颜色
                                      valueIndicatorShape: PaddleSliderValueIndicatorShape(),//气泡形状
                                      valueIndicatorTextStyle: TextStyle(color: Colors.black),//气泡里值的风格
                                      trackHeight: 10 //进度条宽度
                                  ),
                                  child: Slider(
                                    value: value,
                                    onChanged: (v) {
                                      setState(() =>  value = v);
                                      _controller.setDermabrasion(v.toInt());
                                    },
                                    label: "磨皮:$value",//气泡的值
                                    divisions: 10, //进度条上显示多少个刻度点
                                    max: 10,
                                    min: 0,
                                  ),
                                ),
                                Text('美白'),
                                SliderTheme( //自定义风格
                                  data: SliderTheme.of(context).copyWith(
                                      activeTrackColor: Colors.pink, //进度条滑块左边颜色
                                  ),
                                  child: Slider(
                                    value: value2,
                                    onChanged: (v) {
                                      setState(() =>  value2 = v);
                                      _controller.setWhitening(v.toInt());
                                    },
                                    label: "美白:$value2",//气泡的值
                                    divisions: 10, //进度条上显示多少个刻度点
                                    max: 10,
                                    min: 0,
                                  ),
                                ),
                                Text('红润'),
                                SliderTheme( //自定义风格
                                  data: SliderTheme.of(context).copyWith(
                                      activeTrackColor: Colors.pink, //进度条滑块左边颜色
                                  ),
                                  child: Slider(
                                    value: value3,
                                    onChanged: (v) {
                                      setState(() =>  value3 = v);
                                      _controller.setUpRuddy(v.toInt());
                                    },
                                    label: "红润:$value3",//气泡的值
                                    divisions: 10, //进度条上显示多少个刻度点
                                    max: 10,
                                    min: 0,
                                  ),
                                ),
                                MaterialButton(
                                  child: Text("开始直播", style: TextStyle(
                                    color: Colors.white,
                                    fontSize: 20.0
                                  )),
                                  color: Colors.blue,
                                  onPressed: () => _controller.startLive(),
                                ),
                              ],
                            ),
                          ),
                        )
                      ],
                    )
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  rtmp_tencent_live: ^0.0.6

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:rtmp_tencent_live/rtmp_tencent_live.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
30
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]
55
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:rtmp_tencent_live/rtmp_tencent_live.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:rtmp_tencent_live/rtmp_tencent_live.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:rtmp_tencent_live/rtmp_tencent_live.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:rtmp_tencent_live/rtmp_tencent_live.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • rtmp_tencent_live that is a package requiring null.

Health suggestions

Fix lib/rtmp_tencent_live.dart. (-1 points)

Analysis of lib/rtmp_tencent_live.dart reported 2 hints:

line 1 col 8: Unused import: 'dart:async'.

line 2 col 8: Unused import: 'package:flutter/services.dart'.

Format lib/tencent_live.dart.

Run flutter format to format lib/tencent_live.dart.

Format lib/tencent_live_push_Controller.dart.

Run flutter format to format lib/tencent_live_push_Controller.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.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test