tencent_live_fluttify 0.1.4+1 copy "tencent_live_fluttify: ^0.1.4+1" to clipboard
tencent_live_fluttify: ^0.1.4+1 copied to clipboard

discontinued
outdated

A `Tencent Live` flutter plugin, Powered by `Fluttify` engine.

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:tencent_live_fluttify/tencent_live_fluttify.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await TencentLive.instance.init(
    licenseUrl: '#你的授权证书url#',
    licenseKey: '#你的授权证书key#',
  );
  runApp(MyApp());
}

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

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: _HomeScreen());
  }
}

class _HomeScreen extends StatefulWidget {
  const _HomeScreen({
    Key key,
  }) : super(key: key);

  @override
  __HomeScreenState createState() => __HomeScreenState();
}

class __HomeScreenState extends State<_HomeScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Plugin example app'),
      ),
      body: FutureBuilder<bool>(
        future: [
          Permission.camera,
          Permission.microphone,
        ].request().then((it) =>
            it.values.every((status) => status == PermissionStatus.granted)),
        builder: (context, snapshot) {
          if (!snapshot.hasData) {
            return CupertinoActivityIndicator();
          } else {
            return CloudVideo(
              onCloudVideoCreated: (controller) async {
                final player = await LivePlayer.create();
                await player.setPlayerView(controller.playerView);
                await player.startPlay('rtmp://58.200.131.2:1935/livetv/cctv1');
              },
            );
          }
        },
      ),
    );
  }
}
3
likes
0
pub points
0%
popularity

Publisher

verified publisherfluttify.com

A `Tencent Live` flutter plugin, Powered by `Fluttify` engine.

Homepage

License

unknown (LICENSE)

Dependencies

flutter, foundation_fluttify

More

Packages that depend on tencent_live_fluttify