Skip to main content

ijkplayer_flutter_sdk 1.0.12 copy "ijkplayer_flutter_sdk: ^1.0.12" to clipboard
ijkplayer_flutter_sdk: ^1.0.12 copied to clipboard

A Video Player Flutter plugin based on ijkplayer, support most popular protocols and codecs

ijkplayer_flutter_sdk #

A Video Player Flutter plugin based on ijkplayer, support most popular protocols and codecs.

Features #

  • Support most popular video formats and protocols
  • Based on ijkplayer
  • Cross-platform support (Android & iOS)

Documentation #

  • 📖 Code Structure & Navigation - Detailed code organization and quick reference
  • 🎛️ Unified Panel Guide - Complete guide for configurable panel (NEW!)
  • 🎨 Panel Refactoring - UI Panel code organization and improvements
  • 🔀 Panel Comparison - Detailed comparison between Default Panel and Panel2
  • 🔧 Optimization Summary - Performance improvements and best practices
  • 📚 Integration Guide - Platform-specific setup instructions

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  ijkplayer_flutter_sdk: ^1.0.7

Then run:

flutter pub get

Usage #

Basic Example #

import 'package:flutter/material.dart';
import 'package:ijkplayer_flutter_sdk/ijkplayer_flutter_sdk.dart';

class VideoPlayerPage extends StatefulWidget {
  @override
  _VideoPlayerPageState createState() => _VideoPlayerPageState();
}

class _VideoPlayerPageState extends State<VideoPlayerPage> {
  final FlutterIjkPlayer player = FlutterIjkPlayer();

  @override
  void initState() {
    super.initState();
    // Set video source and start playing
    player.setDataSource(
      'https://www.w3schools.com/html/mov_bbb.mp4',
      autoPlay: true,
    );
  }

  @override
  void dispose() {
    player.release();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Video Player')),
      body: Container(
        child: FlutterIjkView(
          player: player,
          color: Colors.black,
          // Use built-in Panel 2 for controls
          panelBuilder: flutterIjkPanel2Builder(),
        ),
      ),
    );
  }
}

Panel Configuration (NEW!) #

The plugin now provides a unified, highly configurable panel. You can customize all features through FlutterIjkPanelConfig:

import 'package:ijkplayer_flutter_sdk/ijkplayer_flutter_sdk.dart';

// Simple style (basic controls)
FlutterIjkView(
  player: player,
  panelBuilder: flutterIjkPanelBuilder(
    config: const FlutterIjkPanelConfig.simple(),
  ),
)

// Advanced style (with gestures)
FlutterIjkView(
  player: player,
  panelBuilder: flutterIjkPanelBuilder(
    config: const FlutterIjkPanelConfig.advanced(),
  ),
)

// Fully customized
FlutterIjkView(
  player: player,
  panelBuilder: flutterIjkPanelBuilder(
    config: FlutterIjkPanelConfig(
      style: FlutterIjkPanelStyle.advanced,
      enableGesture: true,              // Enable gesture controls
      enableVolumeGesture: true,        // Right-side swipe for volume
      enableBrightnessGesture: true,    // Left-side swipe for brightness
      enableDoubleTap: true,            // Double-tap to play/pause
      enableSnapshot: true,             // Screenshot button
      showBackButton: true,             // Back button
      onBack: () => Navigator.pop(context),
      hideDuration: 5000,               // Auto-hide after 5 seconds
      sliderColors: FlutterIjkSliderColors(   // Custom slider colors
        cursorColor: Color(0xFF00BCD4),
        playedColor: Color(0xFF00BCD4),
      ),
    ),
  ),
)

See Unified Panel Guide for complete configuration options.

Legacy APIs (defaultFlutterIjkPanelBuilder and flutterIjkPanel2Builder) are still supported for backward compatibility.

API Reference #

Creating a Player

final player = FlutterIjkPlayer();

Playing a Video

// Set video source and auto play
await player.setDataSource(
  'https://example.com/video.mp4',
  autoPlay: true,
);

// Or set source and play manually
await player.setDataSource('https://example.com/video.mp4');
await player.start();

Controlling Playback

// Play
await player.start();

// Pause
await player.pause();

// Stop
await player.stop();

// Reset
await player.reset();

// Seek to position (in milliseconds)
await player.seekTo(30000); // Seek to 30 seconds

// Set playback speed
await player.setSpeed(1.5); // 1.5x speed

// Set volume (0.0 - 1.0)
await player.setVolume(0.8);

// Set loop count
await player.setLoop(3); // Loop 3 times

Monitoring Player State

// Listen to player value changes
player.addListener(() {
  FlutterIjkValue value = player.value;
  print('State: ${value.state}');
  print('Duration: ${value.duration}');
  print('Position: ${value.currentPos}');
});

// Or use ValueListenableBuilder
ValueListenableBuilder(
  valueListenable: player,
  builder: (context, FlutterIjkValue value, child) {
    return Text('${value.currentPos} / ${value.duration}');
  },
);

Full Screen Support

// Enter full screen
player.enterFullScreen();

// Exit full screen
player.exitFullScreen();

// Check if in full screen
bool isFullScreen = player.value.fullScreen;

Taking Snapshots

// Take a snapshot of current frame
Uint8List imageBytes = await player.takeSnapShot();

Custom UI Panel

FlutterIjkView(
  player: player,
  panelBuilder: (player, data, context, viewSize, texturePos) {
    // Return your custom control panel widget
    return YourCustomPanel(player: player);
  },
);

For more examples, see the example directory.

Platform Support #

Platform Support
Android ✅
iOS ✅

License #

MIT License - see the LICENSE file for details.

1
likes
140
points
42
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Video Player Flutter plugin based on ijkplayer, support most popular protocols and codecs

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, path_provider

More

Packages that depend on ijkplayer_flutter_sdk

Packages that implement ijkplayer_flutter_sdk