Giter Site home page Giter Site logo

flutter_ijkplayer's Introduction

ijkplayer

pub package

ijkplayer,通过纹理的方式接入 bilibili/ijkplayer

使用前请完整阅读本 README 并参阅 example/lib/main.dart

有关 android 可能跑不起来的问题会详细解释

iOS 模拟器不显示图像,所以调试请使用真机(iOS10 iOS 12.1.4 亲测可用,其他版本有问题可反馈) android 模拟器 mac android sdk 自带的 emulator(API28 android9)可用,其他类型的没有亲测不保证

  • android: 我这里 sdk 自带的模拟器可用(音视频均正常)
  • iOS: 库中包含了真机和模拟器的库文件,但是模拟器有声音,无图像

在正式使用前,可以先 star 一下仓库, download 代码跑一下 example 尝试 (clone 也可以)

English Readme

https://github.com/CaiJingLong/flutter_ijkplayer/blob/master/README-EN.md

安装

pub package

最新版本请查看 pub

pubspec.yaml

dependencies:
  flutter_ijkplayer: ${lastes_version}

原生部分说明

自定义编译和原生部分源码

自定义编译的主要目的是修改支持的格式, 因为默认包含了一些编解码器,解复用,协议等等, 这些格式可能你的项目用不到, 这时候可以修改 ffmpeg 的自定义编译选项, 以便于可以缩小库文件的体积, 以达到给 app 瘦身的目的

当前的编译规则文件,修改编译选项,这个参考 bilibili/ijkplayerffmpeg,ffmpeg 的相关信息也可以通过搜索引擎获取

自定义编译选项的完整过程请看文档, 否则不保证编译出来的代码不报错, 具体的更改方案也请查看编译文档, 本篇不再提及

iOS

因为 iOS 部分代码的库文件比较大,为了方便管理版本, 所以创建了一个 pod 依赖托管 iOS 的 ijkplayer 库 pod 库托管在 github 仓库内 ,因为网速原因,源码托管在 azure

因为 framework 文件的大小超过了 100M,所以采用了压缩的方式储存 没有采用通用的 tar.gz 或 zip,而是使用 tar.xz 的方式压缩,这个压缩格式压缩率高,但是压缩和解压缩的的速度慢,综合考虑使用高压缩率的方式来快速获取源文件并解压缩
如果有朋友愿意提供 cdn 加速,可以联系我 😁

iOS 的原始代码来自于 https://github.com/jadennn/flutter_ijk 中提供的 iOS 代码, 但在这基础上有了修改, 不能直接使用这个仓库的源码, 修改后的项目源码托管在gitee

运行慢的问题

最新的 0.3.3 版本的 pod 库(版本号 0.1.0)库文件托管在 azure, 在美西下载速度可以达到 4~5M/s 只需要 20 秒左右就可以下载完, 10 多秒解压缩, 国内则会慢很多, 下载速度 1.5M/s 左右, 所以请耐心等待

0.3.2 以前的 pod 源码托管在 github, 国外下载速度能达到 5~6M/s, 国内速度则不足 100k, 所以可能需要 20 分钟, 建议没有用过这个库的人使用最新版本(0.3.3+)或使用代理

Android

现在的 ffmpeg 编译基本是参考的 GSYVideoPlayer中的 ex-so 的规则, 但当前项目的 c 语言源码有修改(截取视频帧), 所以你不能直接拿别的项目的 so 文件来用, 修改的内容可以在gitee查到

入门示例

import 'package:flutter_ijkplayer/flutter_ijkplayer.dart';


class HomePageState extends State<HomePage> {
  IjkMediaController controller = IjkMediaController();

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

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Plugin example app'),
        actions: <Widget>[
          IconButton(
            icon: Icon(Icons.videocam),
            onPressed: _pickVideo,
          ),
        ],
      ),
      body: Container(
        // width: MediaQuery.of(context).size.width,
        // height: 400,
        child: ListView(
          children: <Widget>[
            buildIjkPlayer(),
          ]
        ),
      ),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.play_arrow),
        onPressed: () async {
          await controller.setNetworkDataSource(
              'https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4',
              // 'rtmp://172.16.100.245/live1',
              // 'https://www.sample-videos.com/video123/flv/720/big_buck_bunny_720p_10mb.flv',
//              "https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4",
              // 'http://184.72.239.149/vod/smil:BigBuckBunny.smil/playlist.m3u8',
              // "file:///sdcard/Download/Sample1.mp4",
              autoPlay: true);
          print("set data source success");
          // controller.playOrPause();
        },
      ),
    );
  }

  Widget buildIjkPlayer() {
    return Container(
      // height: 400, // 这里随意
      child: IjkPlayer(
        mediaController: controller,
      ),
    );
  }
}

使用

设置

每个 ijkplayer 对应一个 IjkMediaController;

IjkMediaController controller = IjkMediaController();

将 controller 设置给 ijkplayer

  var ijkplayer = IjkPlayer(
    mediaController: controller,
  );

关于销毁

用户在确定不再使用 controller 时,必须自己调用 dispose 方法以释放资源,如果不调用,则会造成资源无法释放(后台有音乐等情况),一般情况下,在 ijkplayer 所属的页面销毁时同步销毁

因为一个controller可能被多个IjkPlayer附着, 导致一个controller同时控制多个IjkPlayer,所以原则上不能与IjkPlayerdispose达成一致,所以这里需要调用者自行 dispose,

controller.dispose();

控制器的使用

设置资源

// 根据你的资源类型设置,设置资源本身是耗时操作,建议await

// 网络
await controller.setNetworkDataSource("https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4");

// 设置请求头, 使用headers参数
await controller.setNetworkDataSource(url, headers: <String,String>{});

// 应用内资源
await controller.setAssetDataSource("assets/test.mp4");

// 文件
await controller.setFileDataSource(File("/sdcard/1.mp4"));

// 预览相册视频, photo_manager 插件提供, 在androidQ/iOS下 数百m的video文件就不需要额外缓存即可使用, 可以节省储存空间
await controller.setPhotoManagerDataSource(await assetEntity.getMediaUrl());

// 通过数据源的方式, 这个方式的好处是可以将不同的数据混合到统一数据类型的List中
var dataSource = DataSource.file(File("/sdcard/1.mp4"));
var dataSource = DataSource.network("https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4", headers:<String,String>{});
var dataSource = DataSource.asset("assets/test.mp4");
var dataSource = DataSource.photoManagerUrl(await assetEntity.getMediaUrl());
await controller.setDataSource(dataSource);

// 还可以添加autoplay参数,这样会在资源准备完成后自动播放
await controller.setNetworkDataSource("https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4",autoPlay : true);

//或者也可以在设置资源完毕后自己调用play
await controller.setNetworkDataSource("https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4");
await controller.play();

播放器的控制

// 播放或暂停
await controller.playOrPause();

// 不管当前状态,直接play
await controller.play();

// 不管当前状态,直接pause
await controller.pause();

// 停止
// 这里要说明,ijkplayer的stop会释放资源,导致play不能使用,需要重新准备资源,所以这里其实采用的是回到进度条开始,并暂停
await controller.stop();

// 进度跳转
await controller.seekTo(0.0); //这里是一个double值, 单位是秒, 如1秒100毫秒=1.1s 1分钟10秒=70.0

// 进度跳转百分比
await controller.seekToProgress(0.0); //0.0~1.0

// 暂停其他所有的播放器(适用于ListView滚出屏幕或界面上有多个播放器的情况)
await controller.pauseOtherController();

// 设置媒体音量,这个可以用于做视频静音而不影响系统音量
controller.volume = 100; //范围0~100

// 设置系统音量
await controller.setSystemVolume(100); // 范围0~100

获取播放信息

  // 包含了一些信息,是否在播放,视频宽,高,视频角度,当前播放进度,总长度等信息
  VideoInfo info = await controller.getVideoInfo();

截取视频帧

视频帧的截图

Uint8List的格式导出,可以使用Image控件查看

var uint8List = await controller.screenShot();
var provider = MemoryImage(uint8List);
Widget image = Image(image:provider);

但是有 2 个问题:

  1. 这个和显示中的视频不总完全一样, 这个是因为截取的是解码后的完整视频帧, 可能比当前播放的略快 1~2 帧. 如果你不能接受这种不同步,请不要使用这个功能,或提交可行的 PR
  2. 硬解的情况下不支持截图, 因为只有软解码才有视频帧(这个问题我会在后面尝试解决, 但不保证实现时间)

在设置播放资源前设置软解码

资源监听

使用 stream 的形式向外广播一些信息的变化,原则上以 stream 结尾的属性都是可监听的

// 当纹理id发生变化时的回调,这个对于用户不敏感
Stream<int> textureIdStream = controller.textureIdStream;

// 播放状态的监听,true为正在播放,false为暂停
Stream<bool> playingStream = controller.playingStream;

// 当有调用controller.refreshVideoInfo()时,这个方法会回调,一般用于controllerUI的自定义,以便于监听当前信息(播放进度,播放状态,宽,高,方向变化等)
Stream<VideoInfo> videoInfoStream = controller.videoInfoStream;

// 音量的变化,这里需要注意,这个变化指的是当前媒体的音量变化,而不是系统的音量变化
Stream<bool> volumeStream = controller.playingStream;

// 当前Controller状态的监听,取值范围可以查看
Stream<IjkStatus> ijkStatusStream = controller.ijkStatusStream;

倍速播放

调用代码:

controller.setSpeed(2.0);

支持的倍率默认为 1.0, 上限不明,下限请不要小于等于 0,否则可能会 crash

变调的问题: 由于变速变调的问题, 如果需要不变调, 需要一个 option 的支持, 这个 option 默认开启, 如果要关闭这个, 可以使用如下代码

IjkMediaController(needChangeSpeed: false); // 这个设置为false后, 则变速时会声音会变调的情况发生

IjkStatus 说明

名称 说明
noDatasource 初始状态/调用reset()
preparing 设置资源中
setDatasourceFail 设置资源失败
prepared 准备好播放
pause 暂停
error 发生错误
playing 播放中
complete 播放完毕后
disposed 调用 dispose 后的状态

自定义 Option

**本功能可能会出问题,导致不能播放等等情况,**如果发现设置选项后不能使用或出现异常,请停止使用此功能

支持自定义 IJKPlayer 的 option,这个 option 会直接传输至 android/iOS 原生,具体的数值和含义你需要查看bilibili/ijkplayer的设置选项

但这个设置后的选项不是即时生效的 只有在你重新 setDataSource 以后才会生效

设置方法setIjkPlayerOptions

void initIjkController() async {
  var option1 = IjkOption(IjkOptionCategory.format, "fflags", "fastseek");// category, key ,value

  controller.setIjkPlayerOptions(
    [TargetPlatform.iOS, TargetPlatform.android],
    [option1].toSet(),
  );

  await controller.setDataSource(
    DataSource.network(
        "http://img.ksbbs.com/asset/Mon_1703/05cacb4e02f9d9e.mp4"),
    autoPlay: true,
  );
}

第一个参数是一个数组,代表了你 option 目标设备的类型(android/iOS)

第二个参数是一个Set<IjkOption>,代表了 Option 的集合,因为 category 和 key 均相同的情况下会覆盖,所以这里使用了 set

setIjkPlayerOptions对应的,还有一个addIjkPlayerOptions方法,区别在于 set 是会清空以前所有的配置选项, add 是添加, 只覆盖 category 和 key 均相同的配置选项

IjkOptionCategory

含义请查看 bilibili/ijkplayer 的说明或自行搜索

name
format
codec
sws
player
设置软解码

android 软解码的开启方式: 通过设置分类为 player, key 为 mediacodec, 值为 0

mediaController.setIjkPlayerOptions(
  [
    TargetPlatform.android,
  ],
  [
    IjkOption(IjkOptionCategory.player, "mediacodec", 0),
  ],
);

ios 对应的 key 则是 videotoolbox

mediaController.setIjkPlayerOptions(
  [
    TargetPlatform.ios,
  ],
  [
    IjkOption(IjkOptionCategory.player, "videotoolbox", 0),
  ],
);

释放资源

await controller.reset(); // 这个方法调用后,会释放所有原生资源,但重新设置dataSource依然可用

await controller.dispose(); //这个方法调用后,当前控制器理论上不再可用,重新设置dataSource无效,且可能会抛出异常,确定销毁这个controller时再调用

自定义控制器 UI

使用IJKPlayercontrollerWidgetBuilder属性可以自定义控制器的 UI,默认使用defaultBuildIjkControllerWidget方法构建

签名如下: typedef Widget IJKControllerWidgetBuilder(IjkMediaController controller);

返回的 Widget 会被覆盖在 Texture 上

IJKPlayer(
  mediaController: IjkMediaController(),
  controllerWidgetBuilder: (mediaController){
    return Container(); // 自定义
  },
);

内置的播放器 UI 使用的类为: DefaultIJKControllerWidget

这个类提供了一些属性进行自定义, 除controller外所有属性均为可选:

name type default desc
doubleTapPlay bool false 双击播放暂停
verticalGesture bool true 纵向手势
horizontalGesture bool true 横向手势
volumeType VolumeType VolumeType.system 纵向手势改变的声音类型(系统,媒体)
playWillPauseOther bool true 播放当前是否暂停其他媒体
currentFullScreenState bool false 如果你是自定义全屏界面, 这个必须设置为 true
showFullScreenButton bool true 是否显示全屏按钮
fullscreenControllerWidgetBuilder IJKControllerWidgetBuilder 可以自定义全屏的界面
fullScreenType FullScreenType 全屏的类型(旋转屏幕,或是使用 RotateBox)
hideSystemBarOnFullScreen bool true 进入全屏时,是否自动隐藏状态栏(请看额外说明 1)
onFullScreen void Function(bool) null 全屏状态改变时的回调, 参数为 true 是全屏状态, false 为普通状态

额外说明 1: ios 需要向 Info.plist 添加一条属性

<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>

自定义纹理界面

使用textureBuilder属性自定义纹理界面,在 0.1.8 和之前的版本该属性名是playerBuilder

默认的方法buildDefaultIjkPlayer接受 context,controller,videoInfo 参数返回 Widget

IJKPlayer(
  mediaController: IjkMediaController(),
  textureBuilder: (context,mediaController,videoInfo){
    return Texture(); // 自定义纹理界面
  },
);

根据当前状态构建一个 widget

根据 Controller 当时 IjkStatus 的值构建 Widget,这个 Widget 会根据当前 status 变化而呈现出不同的界面

Widget buildIjkPlayer() {
  return IjkPlayer(
    mediaController: mediaController,
    stateWidgetBuilder: _buildStatusWidget,
  );
}

Widget _buildStatusWidget(
  BuildContext context,
  IjkMediaController controller,
  IjkStatus status,
) {
  if (status == IjkStatus.noDatasource) {
    return Center(
      child: Text(
        "no data",
        style: TextStyle(color: Colors.white),
      ),
    );
  }

  // you can custom your self status widget
  return IjkStatusWidget.buildStatusWidget(context, controller, status);
}

进度

目前正处于初始开发阶段,可能有各种问题,欢迎提出,但不一定会实现,也不一定会修改 😌

最初准备参考官方 video_player 的 api 方式进行开发,但是觉得调用的方式比较奇怪

需要自定义 LifeCycle 进行管理,而且自定义控制器不太方便,遂决定重写 api 的代码结构,同时清晰逻辑

目前属于公开测试使用阶段,不保证不出 bug,也不保证今后 api 不发生重大变更

目前的进度可以查看TODOLIST

UI 控制功能包含常见的播放停止,手势拖动

LICENSE

MIT

flutter_ijkplayer's People

Contributors

caijinglong avatar dotcink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_ijkplayer's Issues

[Need help]直播时的手势问题

在直播时,如果用手势左右滑动会操作进度,导致直播内容异常,请问该怎么选择性的屏蔽部分手势功能呢?

加载视频,是不是有设置超时时间呢?

播放视频的源,因为加载比较耗时,两三秒就报错了

    "LocalDataTask <053C8B40-B031-49C0-A3FE-6A01DBE8A42E>.<1>"
)} [303]
	[C2.1 C141AF96-99E6-49A0-969B-64E5DB49964B 192.168.1.108:54305<->124.192.164.41:443]
	Connected Path: satisfied (Path is satisfied), interface: en1
	Duration: 10.245s, DNS @0.005s took 0.016s, TCP @0.024s took 0.044s, TLS took 0.113s
	bytes in/out: 4002/756, packets in/out: 7/7, rtt: 0.041s, retransmitted packets: 0, out-of-order packets: 0

偶尔会出现 视频无法关闭

使用的同一个IjkMediaController去播放视频。

每次播放下一个视频时,我都掉用了销毁相关的方法。

刚开始没有问题,可是播放几个视频后,就出现有的视频源一直在播放,声音一直存在。

我写的关闭方法是:

await _ijkController.pauseOtherController();
await _ijkController.pause();
await _ijkController.stop();
await _ijkController.reset();

[Need help] Confirm if rtmp is working

Hello @CaiJingLong! Awesome stuff, thanks for all the effort you put into this.

I would like to confirm that rtmp protocol is working as you inteded it to. I created an app based on your english readme, all network playback works as they should but rtmp. All I get is a black screen.

On the other end of the stream, I used nginx-rtmp module. I confirmed that the stream works by viewing it with an rtmp-capable player: MX Player.

[Need help] About FullScreen

有几个问题想咨询下大神

1、视频全屏后,能否修改退出全屏按钮的位置,statusWidgetBuilder在窗口播放时能在上面自定义内容,全屏发现无效果;

2、视频全屏后,物理返回是返回页面,而不只是退出全屏状态,这块能修改吗

[Need help]release版本 app闪退

** 简单描述 **
用flutter的pakages导入此库,使用此库后,debug版本可用,flutter build apk出来的app直接启动页闪退,注释此库,正常运行,是需要什么设置吗

** 辅助信息 **

flutter_ijkplayer 在IOS真机上运行报错

描述一下你遇到的bug
➜ flutter build ios
Building flutter.sex.com.sex for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: GU9M63AKDT
Running pod install... 0.7s
CocoaPods' output:

Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

Finding Podfile changes
  A flutter_ijkplayer
  M Flutter
  - path_provider
  - shared_preferences
  - url_launcher

Fetching external sources
-> Fetching podspec for `Flutter` from `.symlinks/flutter/ios-release`
-> Fetching podspec for `flutter_ijkplayer` from `.symlinks/plugins/flutter_ijkplayer/ios`
-> Fetching podspec for `path_provider` from `.symlinks/plugins/path_provider/ios`
-> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`
-> Fetching podspec for `url_launcher` from `.symlinks/plugins/url_launcher/ios`

Resolving dependencies of `Podfile`
[!] Unable to find a specification for `FlutterIJK (~> 0.0.9)` depended upon by `flutter_ijkplayer`

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:402:in `find_cached_set'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:372:in `specifications_for_dependency'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:177:in `search_for'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:288:in `block in sort_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:281:in `each'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:281:in `sort_by'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:281:in `sort_dependencies'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:53:in `block in sort_dependencies'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:70:in `with_no_such_dependency_error_handling'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:52:in `sort_dependencies'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:754:in `push_state_for_requirements'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:746:in `require_nested_dependencies_for'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:729:in `activate_new_spec'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:686:in `attempt_to_activate'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:123:in `resolve'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:781:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:779:in `resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:88:in `analyze'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:243:in `analyze'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:154:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:153:in `resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:116:in `install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'

Error output from CocoaPods:

[!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for
this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error running pod install

2.运行 pos install
➜ ios pod install
Analyzing dependencies
Fetching podspec for Flutter from .symlinks/flutter/ios-release
Fetching podspec for flutter_ijkplayer from .symlinks/plugins/flutter_ijkplayer/ios
Fetching podspec for path_provider from .symlinks/plugins/path_provider/ios
Fetching podspec for shared_preferences from .symlinks/plugins/shared_preferences/ios
Fetching podspec for url_launcher from .symlinks/plugins/url_launcher/ios
[!] Unable to find a specification for FlutterIJK (~> 0.0.9) depended upon by flutter_ijkplayer

[!] Automatically assigning platform ios with version 8.0 on target Runner because no platform was specified. Please specify a platform for this target in your Podfile. See https://guides.cocoapods.org/syntax/podfile.html#platform.

说没有FlutterIJK 不知道怎么处理

安卓会报这个错

Launching lib/main.dart on M10 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "/Users/xxxxxx/examples/flutter_test_demo/android/gradlew" exited abnormally:

> Configure project :flutter_ijkplayer

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/seifon/dev-tool/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_ijkplayer-0.2.2/android/build.gradle' line: 23

* What went wrong:
A problem occurred evaluating project ':flutter_ijkplayer'.
> Plugin with id 'kotlin-android-extensions' not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
  Command: /Users/seifon/Project/examples/flutter_test_demo/android/gradlew app:properties

Finished with error: Please review your Gradle project setup in the android/ folder.

依赖下载不下来啊

ERROR: Unable to resolve dependency for ':flutter_ijkplayer@debug/compileClasspath': Could not resolve tv.danmaku.ijk.media:ijkplayer-java:0.8.8.

IOS真机播放没有图像

IOS真机播放没有图像,偶尔会有图像,但是不能拖动,一拖动就会卡在那里。有的时候,进去就是黑屏的。

请问一下flutter[Need help]

请问一下flutter有几种方式播放视频,除了纹理的方式还有其他的吗 目前纹理的方式是不是 性能最好的?

IOS编译时,会报这个错

Launching lib/main.dart on iPhone in debug mode...
Signing iOS app for device deployment using developer identity: "iPhone Developer: xxxxxx (xx xx)"
Running pod install...
CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Fetching external sources
    -> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
    -> Fetching podspec for `flutter_ijkplayer` from `.symlinks/plugins/flutter_ijkplayer/ios`

    Resolving dependencies of `Podfile`
    [!] Unable to find a specification for `FlutterIJK (~> 0.0.9)` depended upon by `flutter_ijkplayer`

    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:402:in `find_cached_set'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:372:in `specifications_for_dependency'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:177:in `search_for'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:288:in `block in sort_dependencies'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:281:in `each'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:281:in `sort_by'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:281:in `sort_dependencies'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:53:in `block in sort_dependencies'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:70:in `with_no_such_dependency_error_handling'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:52:in `sort_dependencies'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:754:in `push_state_for_requirements'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:746:in `require_nested_dependencies_for'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:729:in `activate_new_spec'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:686:in `attempt_to_activate'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in `process_topmost_state'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/resolver.rb:123:in `resolve'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:781:in `block in resolve_dependencies'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in `section'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:779:in `resolve_dependencies'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:88:in `analyze'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:243:in `analyze'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:154:in `block in resolve_dependencies'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in `section'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:153:in `resolve_dependencies'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:116:in `install!'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:in `run'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/bin/pod:22:in `load'
    /usr/local/Cellar/cocoapods/1.5.3/libexec/bin/pod:22:in `<main>'

Error output from CocoaPods:
↳

    [!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Finished with error: Error running pod install

rtsp播放

播放rtsp流黑屏,只有进度条正常

ijkController.isInit 获取不准确

之前在释放资源前,都会调一下这个方法判断控制器是否初始化完毕,再释放。

可有的时候,取出来的状态不对,原本是初始化了,可是结果却是没有初始化。

希望您留意下这个问题

[Need help]求助,加密的m3u8视频无法播放,不知为何?

求助,ios平台加密的m3u8视频无法播放,安卓平台可以,不知为何?

ios logs:
ijkmediaplayer version : k0.8.8-7-g96d0bd3e===== custom modules begin =====
register demuxer : ijklivehook
===== custom modules end =====
av_version_info: ff3.4--ijk0.8.7--20180103--001
ijk_version_info: k0.8.8-7-g96d0bd3e
ijkmp_set_inject_opaque(0x281596640)
ijkmp_set_inject_opaque()=void
ijkmp_set_ijkio_inject_opaque(0x281596640)
ijkmp_set_ijkio_inject_opaque()=void
2019-05-18 22:06:03.477280+0800 Runner[2616:827368] OK setup GL
ijkmp_ios_set_view(glView=0x14e920f70)
ijkmp_ios_set_view(glView=0x14e920f70)=void
ijkmp_set_data_source
ijkmp_prepare_async()
ijkmp_prepare_async()=0
FFP_MSG_ERROR: 0
flutter: (w)Ijk:play error , errorValue : 0

[Bug]关于客户端闪退问题报告

我经过测试其实不是 安卓9.0会崩溃而是因为在
~/project1/android/build.gradle 中加入了
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

这段代码的话 我通过正常的发包 flutter build apk --release 然后下载到手机上后会出现 闪退的情况 不止安卓9.0我的安卓7.0也会出现闪退
不是做安卓出来的遇到这个问题很痛苦 有没有办法解决?
今天试了很多办法都不行

系统信息:
➜ huangua2 flutter doctor -v
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.3 18D109, locale zh-Hans-CN)
• Flutter version 1.2.1 at /Users/sam/flutter
• Framework revision 8661d8aecd (8 weeks ago), 2019-02-14 19:19:53 -0800
• Engine revision 3757390fa4
• Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/sam/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /Users/sam/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
• ios-deploy 1.9.4
• CocoaPods version 1.5.3

[✓] Android Studio (version 3.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 34.0.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[!] IntelliJ IDEA Ultimate Edition (version 2018.2.4)
• IntelliJ at /Applications/IntelliJ IDEA.app
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.io/intellij-setup/#installing-the-plugins

[✓] Connected device (1 available)
• OD103 • a013c25f • android-arm64 • Android 7.1.1 (API 25)

! Doctor found issues in 1 category.

监听数据的问题

请问 flutter_ijkplayer 有没有办法监听 播放器事件比如VideoPlayer 插件
能不能支持 addListener 事件
_videoPlayerController1 = VideoPlayerController.network(widget.url)..addListener(() {
final bool isPlaying = _videoPlayerController1.value.isPlaying;
if (isPlaying != _isPlaying) {
setState(() { isPlaying = isPlaying; });
}
})..initialize().then((
) {
setState(() {});
})

About issue ( issue 的一些简单管理规则)

issue遵循以下几个原则:

  1. 优先修复bug, 新功能实现优先级低.
  2. 无法复现的"bug"不处理,包括偶发问题(除非有相对完整的日志反馈),会保持一段时间的开启状态,但如果长时间(7天左右)没有进一步的可定位报告,会关闭.
  3. 已处理的问题在一段时间(一般7天左右),如open人员不关闭,我会关闭它.
  4. 需要进一步信息,且7天内无回复的,暂时关闭处理.
  5. 确认是bug的, 无法处理的问题会长期开启.
  6. 新功能不保证实现时间, 如果确定未来不会加入实现的新功能请求会被关闭.
  7. help wanted 标签的问题, 如得到解决/解答, 某一段时间会统一关闭.

问题模板中的信息,如果不能完全满足,也请换位思考, 能否用于解决问题.

[Need help]flutter build ios时会有异常

连接手机跑起来没问题,想编译打包,执行flutter build ios时出现以下错误,没做过ios原生,求大神帮解答

Xcode's output:

=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Release ===
ld: warning: ignoring file /Users/yujie/AndroidStudioProjects/flutter_app/ios/Pods/FlutterIJK/IJKMediaFramework.framework/IJKMediaFramework, missing required architecture armv7 in file
/Users/yujie/AndroidStudioProjects/flutter_app/ios/Pods/FlutterIJK/IJKMediaFramework.framework/IJKMediaFramework (3 slices)
Undefined symbols for architecture armv7:
"OBJC_CLASS$_IJKFFOptions", referenced from:
objc-class-ref in libflutter_ijkplayer.a(CoolFlutterIJK.o)
"_IJKMPMoviePlayerVideoRotationRotateUserInfoKey", referenced from:
-[CoolIjkNotifyChannel movieRotationChange:] in libflutter_ijkplayer.a(CoolIjkNotifyChannel.o)
"_IJKMPMoviePlayerPlaybackStateDidChangeNotification", referenced from:
-[CoolIjkNotifyChannel registerObserver] in libflutter_ijkplayer.a(CoolIjkNotifyChannel.o)
-[CoolIjkNotifyChannel unregisterObservers] in libflutter_ijkplayer.a(CoolIjkNotifyChannel.o)
"_IJKMPMoviePlayerVideoRotationNotification", referenced from:
-[CoolIjkNotifyChannel registerObserver] in libflutter_ijkplayer.a(CoolIjkNotifyChannel.o)
-[CoolIjkNotifyChannel unregisterObservers] in libflutter_ijkplayer.a(CoolIjkNotifyChannel.o)
"_IJKMPMoviePlayerPlaybackDidFinishNotification", referenced from:
-[CoolIjkNotifyChannel registerObserver] in libflutter_ijkplayer.a(CoolIjkNotifyChannel.o)
-[CoolIjkNotifyChannel unregisterObservers] in libflutter_ijkplayer.a(CoolIjkNotifyChannel.o)
"OBJC_CLASS$_IJKFFMoviePlayerController", referenced from:
objc-class-ref in libflutter_ijkplayer.a(CoolFlutterIJK.o)
"_IJKMPMoviePlayerLoadStateDidChangeNotification", referenced from:
-[CoolIjkNotifyChannel registerObserver] in libflutter_ijkplayer.a(CoolIjkNotifyChannel.o)
-[CoolIjkNotifyChannel unregisterObservers] in libflutter_ijkplayer.a(CoolIjkNotifyChannel.o)
"_IJKMPMediaPlaybackIsPreparedToPlayDidChangeNotification", referenced from:
-[CoolIjkNotifyChannel registerObserver] in libflutter_ijkplayer.a(CoolIjkNotifyChannel.o)
-[CoolIjkNotifyChannel unregisterObservers] in libflutter_ijkplayer.a(CoolIjkNotifyChannel.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Encountered error while building for device.

初始化播放时,不能监听到状态

比如我要播放这个地址:

https://js.wshls.acgvideo.com/live-js/922199/live_8747041_1741679.m3u8?wsSecret=1337e20698b1673ac73ea8f35e2d60e8&wsTime=1556966389&trid=5afe0383d7d149dabe0c0327c2e53a75&order=1&sig=no

这个地址是404的,然后加载播放,日志里面都打印错误了。可是写的状态监听,确监听不到消息。

日志:

D/IJKMEDIA(22697): ijkmp_prepare_async()=0
I/IJKMEDIA(22697): SDL_RunThread: [22781] ff_read
I/IJKMEDIA(22697): SDL_RunThread: [22780] ff_vout
W/IJKMEDIA(22697): https protocol not found, recompile FFmpeg with openssl, gnutls or securetransport enabled.
E/IJKMEDIA(22697): https://js.wshls.acgvideo.com/live-js/922199/live_8747041_1741679.m3u8?wsSecret=1337e20698b1673ac73ea8f35e2d60e8&wsTime=1556966389&trid=5afe0383d7d149dabe0c0327c2e53a75&order=1&sig=no: Protocol not found
I/IJKMEDIA(22697): SDL_JNI_DetachThreadEnv: [22781]
D/IJKMEDIA(22697): FFP_MSG_ERROR: 0
E/tv.danmaku.ijk.media.player.IjkMediaPlayer(22697): Error (-10000,0)
I/NotifyChannel(22697): onError -10000
I/NotifyChannel(22697): completion {duration=0.0, tcpSpeed=0, isPlaying=false, outputFps=0.0, currentPosition=0.0, width=0, degree=0, height=0}

监听代码:

_ijkController.ijkStatusStream.listen((ijkStatus) {
        print("监听到状态.... ${ijkStatus.toString()}");
      });

关于新版0.2.4 的 全屏显示 Bug

你好我看新版的0.2.4用的是Navigator.push实现的但是这样就会涉及到 页面的生命周期,调用.push的时候原页面会 调用 dispose但是如果缩小全屏的时候页面又要重新加载 这样不太合理吧

IjkPlayer 自定义 controllerWidgetBuilder

自定义的几个地方,希望能够不限制类型和参数个数额,我想自定义一个controllerWidgetBuilder,需要多传一个对象参数进去,发现无法通过编译。

另外,希望几个自定义的地方,能够放开类型限制,或者做一下更好的调整

typedef Widget IJKControllerWidgetBuilder(IjkMediaController controller);

/// default create IJK Controller UI
Widget defaultBuildIjkControllerWidget(IjkMediaController controller) {
  return DefaultIJKControllerWidget(
    controller: controller,
//    verticalGesture: false,
//    horizontalGesture: false,
  );
}

我想这样传,发现过不了编译:

Widget qIjkControllerWidget(IjkMediaController controller, HomeItem homeItem) {
  return QIjkController(
    controller: controller,
    homeItem: homeItem,
//    verticalGesture: false,
//    horizontalGesture: false,
  );
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.