flutter_txugcupload 0.0.1 copy "flutter_txugcupload: ^0.0.1" to clipboard
flutter_txugcupload: ^0.0.1 copied to clipboard

outdated

适用于 Flutter 的腾讯云点播上传 SDK

flutter_txugcupload #

适用于 Flutter 的腾讯云点播上传 SDK

pub version

快速开始 #

安装 #

将此添加到包的 pubspec.yaml 文件中:

dependencies:
  flutter_txugcupload: ^0.0.1

您可以从命令行安装软件包:

$ flutter packages get

用法 #

实现一个视频上传进度监听器(TXVideoPublishListener)

class VideoPublishListener extends TXVideoPublishListener {
  final Function(int uploadBytes, int totalBytes) onVideoPublishProgress;
  final Function(TXPublishResult result) onVideoPublishComplete;

  VideoPublishListener({
    this.onVideoPublishProgress,
    this.onVideoPublishComplete,
  });

  @override
  void onPublishProgress(int uploadBytes, int totalBytes) {
    if (this.onVideoPublishProgress == null) return;

    this.onVideoPublishProgress(uploadBytes, totalBytes);
  }

  @override
  void onPublishComplete(TXPublishResult result) {
    if (this.onVideoPublishComplete == null) return;

    this.onVideoPublishComplete(result);
  }
}

上传视频

TXUGCPublish txUgcPublish = TXUGCPublish(customKey: '<customKey>');

TXPublishParam param = TXPublishParam(
  videoPath: '<videoPath>',
  signature: '<signature>',
);
txUgcPublish.setVideoPublishListener(VideoPublishListener(
  onVideoPublishProgress: (uploadBytes, totalBytes) {
    int progress = ((uploadBytes / totalBytes) * 100).toInt();
  },
  onVideoPublishComplete: (result) {
    // 当 result.errCode 为 0 时即为上传成功,更多错误码请查看下方链接
    // https://cloud.tencent.com/document/product/266/9539#.E9.94.99.E8.AF.AF.E7.A0.81
  },
));
txUgcPublish.publishVideo(param);

相关链接 #

许可证 #

MIT License

Copyright (c) 2020 LiJianying <lijy91@foxmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2
likes
0
pub points
0%
popularity

Publisher

verified publisherleanflutter.org

适用于 Flutter 的腾讯云点播上传 SDK

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_txugcupload