video_player_rtmp_ext

pub

A player supporting rtmp,rtmps,m3u8 live video

Your flutter version must be greater than or equal to 3.3.2 to use this plug-in

  • Test Link
  1. http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear2/prog_index.m3u8
  2. rtmp://ns8.indexforce.com/home/mystream
  3. rtmp://mobliestream.c3tv.com:554/live/goodtv.sdp

Getting Started

video_player_rtmp_ext: ^last_version
Android
  • in project build.gradle add this line
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
        maven { url "https://maven.aliyun.com/repository/public" }
    }
}
  • add minSdkVersion set to 19

  • add android:usesCleartextTraffic="true" to you AndroidManifest.xml file

iOS

Update youProject/ios/Podfile

target 'Runner' do
  # update this line 
  use_frameworks! :linkage => :static 
  use_modular_headers!
end
pod install

1.Simple example

  • Initialize controller
IJKPlayerController controller = IJKPlayerController.network("http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear2/prog_index.m3u8");
  • Using widgets
VideoPlayerRtmpExtWidget(
   controller: controller,
   viewCreated: (IJKPlayerController _){
       controller.play();
   },
)

2. Controller API

  • Start
controller.play();
  • Pause
controller.pause();
  • Stop
controller.stop();
  • Resume
controller.resume();
  • Judge whether it is playing
final isPlaying = await controller.isPlaying;
  • If you want to play the m3u8 video, please add this line (only android)
if(controller.isAndroid){
   await controller.setPlayManager(PlayerFactory.exo2PlayerManager);
}
  • player state change callback
controller.addListener(onStateChange);
...
void onStateChange(VideoListenerModel model){
  debugPrint("$model");
  model.when(progress: (progress, secProgress, currentPosition, duration) {
  // todo : Playback progress
  }, playbackState: (playbackState) {
  // todo: Playback state
  }, onPlayError: (error) {
  // todo : error callback detail info
  },);
}