Giter Site home page Giter Site logo

jadennn / flutter_ijk Goto Github PK

View Code? Open in Web Editor NEW
135.0 4.0 45.0 18.81 MB

flutter封装的ijkplayer,支持rtsp播放

License: MIT License

Java 4.54% Objective-C 14.30% Dart 6.23% Ruby 0.21% C 3.46% C++ 71.26%
ijkplayer rtsp flutter video-player ios android

flutter_ijk's Introduction

flutter_ijk

由于工作重心变动,已经不做应用了,该项目不再维护

A FLUTTER PLAYER SUPPORT RTSP PROTOCOLS

flutter_ijk 是flutter端的ijkplayer播放器,在IOS和Android native端都使用的是bilibili的ijkplayer,由于GitHub大小限制,本项目的ijkplayer源码放在码云,已经定制过编译脚本和部分的功能代码,可以参考以下步骤来获取: https://gitee.com/jadennn/flutter_ijkplayer_source.git

使用

1 . 在pubspec.yaml增加以下引用

  flutter_ijk:
    git:
      url: https://github.com/jadennn/flutter_ijk

  1. api参考的是video_player,使用方法相同

例子:

class VideoPageState extends State<VideoPage> {
  IjkPlayerController _controller;

  @override
  void initState(){
    super.initState();
      _controller = IjkPlayerController.network("rtsp://admin:[email protected]/h264/ch1/main/av_stream")
        ..initialize().then((_) {
          setState(() {});
          _controller.play();
        });
  }


  @override
  Widget build(BuildContext context) {
    return Material(
      child: _controller == null ? Container(): Center(
        child:
          _controller.value.initialized
              ? AspectRatio(
                  aspectRatio: _controller.value.aspectRatio,
                  child: IjkPlayer(_controller),
                )
              : Container(),
      ),
    );
  }
  
 ///一定要记得释放资源,否则会造成内存泄漏
 void _stop() async{
    if (_controller != null) {
      await _controller.dispose();
      _controller = null;
    }
  }

  @override
  void dispose() {
    super.dispose();
    _stop();
  }
}
  1. 参考文档

感谢以下项目:

ijkplayer
video_player
camera

  1. 如果出现类似下面的错误
 === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    ld: warning: ignoring file /Users/bkillian/repos/flutter_ijk/ios/IJKMediaFramework.framework/IJKMediaFramework,
    file was built for unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73
    0x3A 0x2F 0x2F ) which is not the architecture being linked (x86_64):
    /Users/bkillian/repos/flutter_ijk/ios/IJKMediaFramework.framework/IJKMediaFramework
    Undefined symbols for architecture x86_64:
      "_OBJC_CLASS_$_IJKFFOptions", referenced from:
          objc-class-ref in libflutter_ijk.a(FlutterIjkPlugin.o)
      "_IJKMPMoviePlayerPlaybackDidFinishNotification", referenced from:
          -[FLTVideoPlayer installMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
          -[FLTVideoPlayer removeMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
      "_IJKMPMoviePlayerPlaybackDidFinishReasonUserInfoKey", referenced from:
          -[FLTVideoPlayer moviePlayBackFinish:] in libflutter_ijk.a(FlutterIjkPlugin.o)
      "_OBJC_CLASS_$_IJKFFMoviePlayerController", referenced from:
          objc-class-ref in libflutter_ijk.a(FlutterIjkPlugin.o)
      "_IJKMPMoviePlayerLoadStateDidChangeNotification", referenced from:
          -[FLTVideoPlayer installMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
          -[FLTVideoPlayer removeMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
      "_IJKMPMediaPlaybackIsPreparedToPlayDidChangeNotification", referenced from:
          -[FLTVideoPlayer installMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
          -[FLTVideoPlayer removeMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
      "_IJKMPMoviePlayerPlaybackStateDidChangeNotification", referenced from:
          -[FLTVideoPlayer installMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
          -[FLTVideoPlayer removeMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

这是因为IOS的framework太大,上传git的时候使用了git lfs功能,但是pod仓库在处理git lfs可能会有bug,导致文件缺失,为了解决这个问题,强烈建议将本仓库的代码下载到本地,直接在本地引用到项目中,引用方法: 将本项目复制到你的项目的根目录的plugins下(如果没有,新建一个plugins),在pubspec.yaml中新增

flutter_ijk:
  path:plugins/flutter_ijk

然后就可以正常引用了

  1. 强烈建议自己编译IJKPlayer,IJKPlayer的源代码已经经过了我的定制,只用配置好环境,IOS和Android共用同一个仓库,源代码和编译方法见:https://gitee.com/jadennn/flutter_ijkplayer_source.git

flutter_ijk's People

Contributors

ened avatar jadennn 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

flutter_ijk's Issues

Issue running example project on iOS

When I try to run project on iOS I get this output:

  ~/repos/flutter_iJK/example     master  flutter run -d all                          4761  12:41:15 
Running "flutter packages get" in example...                 2.2s
Launching lib/main.dart on iPhone X in debug mode...
Running pod install...                                       1.5s
Starting Xcode build...
 ├─Assembling Flutter resources...                    1.9s

 └─Compiling, linking and signing...                  0.9s

Xcode build done.                                            8.2s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    ld: warning: ignoring file /Users/bkillian/repos/flutter_ijk/ios/IJKMediaFramework.framework/IJKMediaFramework,
    file was built for unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73
    0x3A 0x2F 0x2F ) which is not the architecture being linked (x86_64):
    /Users/bkillian/repos/flutter_ijk/ios/IJKMediaFramework.framework/IJKMediaFramework
    Undefined symbols for architecture x86_64:
      "_OBJC_CLASS_$_IJKFFOptions", referenced from:
          objc-class-ref in libflutter_ijk.a(FlutterIjkPlugin.o)
      "_IJKMPMoviePlayerPlaybackDidFinishNotification", referenced from:
          -[FLTVideoPlayer installMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
          -[FLTVideoPlayer removeMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
      "_IJKMPMoviePlayerPlaybackDidFinishReasonUserInfoKey", referenced from:
          -[FLTVideoPlayer moviePlayBackFinish:] in libflutter_ijk.a(FlutterIjkPlugin.o)
      "_OBJC_CLASS_$_IJKFFMoviePlayerController", referenced from:
          objc-class-ref in libflutter_ijk.a(FlutterIjkPlugin.o)
      "_IJKMPMoviePlayerLoadStateDidChangeNotification", referenced from:
          -[FLTVideoPlayer installMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
          -[FLTVideoPlayer removeMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
      "_IJKMPMediaPlaybackIsPreparedToPlayDidChangeNotification", referenced from:
          -[FLTVideoPlayer installMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
          -[FLTVideoPlayer removeMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
      "_IJKMPMoviePlayerPlaybackStateDidChangeNotification", referenced from:
          -[FLTVideoPlayer installMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
          -[FLTVideoPlayer removeMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

Could not build the application for the simulator.
Error launching application on iPhone X.

Steps to reproduce:

git pull https://github.com/jadennn/flutter_ijk.git
cd flutter_ijk/example
(run ios X simulator xCode 10.1, Mojave 10.14.2)
flutter run -d all

Any idea on this one?

copyPixelBuffer不调用问题

当视频播放出来过后,一直有声音,无画面。copyPixelBuffer并没有调用,想请问一下,你知道怎么回事吗

listener will not be called when "initialized" switches from false to true

Given this code:

_controller = IjkPlayerController.network(uri);
_controller.addListener(_ijkListener);

_controller.initialize().then((player) {
  // Need to manually call the listener once we are initialize
  _ijkListener();

  _controller.play();
});

It seems that the listener is not receiving the status from "unitialized" to "initialized".

Failed to build iOS app?

示例代码example无法run,以下是报错日志,

Failed to build iOS app
Error output from Xcode build:

2019-08-27 14:38:36.477 xcodebuild[30556:478804] [MT] PluginLoading: Required plug-in compatibility UUID 72F7D751-F810-43B8-A53F-1F1DFD74FC54 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
** BUILD FAILED **
Xcode's output:

=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
ld: warning: ignoring file /Users/xxx/Downloads/flutter_ijk-master/ios/IJKMediaFramework.framework/IJKMediaFramework, file was built for unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F ) which is not the architecture being linked (x86_64): /Users/xxx/Downloads/flutter_ijk-master/ios/IJKMediaFramework.framework/IJKMediaFramework
Undefined symbols for architecture x86_64:
"OBJC_CLASS$_IJKFFOptions", referenced from:
objc-class-ref in libflutter_ijk.a(FlutterIjkPlugin.o)
"_IJKMPMoviePlayerPlaybackDidFinishNotification", referenced from:
-[FLTIJKVideoPlayer installMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
-[FLTIJKVideoPlayer removeMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)
"_IJKMPMoviePlayerPlaybackDidFinishReasonUserInfoKey", referenced from:
-[FLTIJKVideoPlayer moviePlayBackFinish:] in libflutter_ijk.a(FlutterIjkPlugin.o)
"OBJC_CLASS$_IJKFFMoviePlayerController", referenced from:
objc-class-ref in libflutter_ijk.a(FlutterIjkPlugin.o)
"_IJKMPMoviePlayerLoadStateDidChangeNotification", referenced from:
-[FLTIJKVideoPlayer installMovieNotificationObservers] in libflutter_ijk.a(FlutterIjkPlugin.o)

about LICENSE

我下载了你提供的百度网盘连接中的文件,发现其中有一些修改。
你关于修改后的代码遵循的 "LICENSE" 是什么?

打包后APP闪退

使用你的插件写了一个海康威视云台控制的demo,在模拟器上APP没问题,打包debug和release版本在手机上都闪退。无任何报错。Target版本是Android Q API 29 最低API 16

Warning when combining with video_player plugin

objc[35184]: Class FLTFrameUpdater is implemented in both 
/private/var/containers/Bundle/Application/C860D20D-BAB9-4EC5-B2C3-3A96411E9C7B/Runner.app/Frameworks/video_player.framework/video_player (0x1056aa0e0) and
/private/var/containers/Bundle/Application/C860D20D-BAB9-4EC5-B2C3-3A96411E9C7B/Runner.app/Frameworks/flutter_ijk.framework/flutter_ijk (0x1050a0b08). 
One of the two will be used. Which one is undefined.

objc[35184]: Class FLTVideoPlayer is implemented in both 
/private/var/containers/Bundle/Application/C860D20D-BAB9-4EC5-B2C3-3A96411E9C7B/Runner.app/Frameworks/video_player.framework/video_player (0x1056aa108) and 
/private/var/containers/Bundle/Application/C860D20D-BAB9-4EC5-B2C3-3A96411E9C7B/Runner.app/Frameworks/flutter_ijk.framework/flutter_ijk (0x1050a0b30).
One of the two will be used. Which one is undefined.

This happens on iOS projects that include both video_player and flutter_ijk.

problem build release

hello!

dependencies:
  flutter:
    sdk: flutter
  flutter_ijk:
    git:
      url: https://github.com/jadennn/flutter_ijk

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'flutter_ijk'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* 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 731ms


The plugin flutter_ijk could not be built due to the issue above.

NoSuchMethod error for `.remove()`

When added / removing the widget a few times

I  ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I  The following NoSuchMethodError was thrown building BlocBuilder<MyEvent, MyViewState>:
I  The method 'remove' was called on null.
I  Receiver: null
I  Tried calling: remove()
I  When the exception was thrown, this was the stack:
I  #0      ChangeNotifier.removeListener (package:flutter/src/foundation/change_notifier.dart:167)
I  #1      _IjkPlayerState.deactivate (package:flutter_ijk/flutter_ijk.dart:498)
I  #2      StatefulElement.deactivate (package:flutter/src/widgets/framework.dart:3914)
I  #3      _InactiveElements._deactivateRecursively (package:flutter/src/widgets/framework.dart:1714)
I  #4      SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:4869)
I  #5      _InactiveElements._deactivateRecursively (package:flutter/src/widgets/framework.dart:1716)
I  #6      MultiChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:4970)
I  #7      _InactiveElements._deactivateRecursively (package:flutter/src/widgets/framework.dart:1716)
I  #8      _InactiveElements.add (package:flutter/src/widgets/framework.dart:1725)
I  #9      Element.deactivateChild (package:flutter/src/widgets/framework.dart:2996)
I  #10     Element.updateChild (package:flutter/src/widgets/framework.dart:2760)
I  #11     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3752)
I  #12     Element.rebuild (package:flutter/src/widgets/framework.dart:3564)
I  #13     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2277)
I  #14     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter
  /src/widgets/binding.dart:700)
I  #15     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:f
  lutter/src/rendering/binding.dart:275)
I  #16     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1012)
I  #17     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:952)
I  #18     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:864)
I  #22     _invoke (dart:ui/hooks.dart:219)
I  #23     _drawFrame (dart:ui/hooks.dart:178)
I  (elided 3 frames from package dart:async)

IJKFFMoviePlayerController

作者你好 方便告知在 IJKFFMoviePlayerController.m 文件中是如何处理 - framePixelbuffer 的吗? 谢谢啊

根据demo运行报错

error如下
ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method create on channel jaden.com/flutterijk)

image

截图

screenshot 方法咋没了

Accept another ports than 544 on RSTP streams

When I have some cameras in different ports (different of 554 RSTP default), in the same address, I can't access the RSTP stream specifying the port in the URL. Is there any other way to specify the port?

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.