Coder Social home page Coder Social logo

musma / flutter_gstreamer_player Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hpdragon1618/flutter_gstreamer_player

0.0 0.0 0.0 1.77 MB

A GStreamer-powered alternative to Flutter's video_player that support Linux, iOS and Android.

License: MIT License

Ruby 2.67% C++ 14.78% C 3.36% Objective-C 45.93% Java 8.11% Kotlin 2.93% Dart 6.74% Swift 5.65% Makefile 1.59% CMake 8.23%

flutter_gstreamer_player's Introduction

GStreamer Player Plugin

A GStreamer-powered alternative to Flutter's video_player that support Linux, iOS and Android.

Buy Me A Coffee

Installation

Linux

Follow GStreamer's Install on Linux instuction.

iOS

Follow GStreamer's Install on iOS instuction, step Prerequisites and Download and install GStreamer binaries.

Link GStreamer framework to ios directory for flutter's ios build system.

ln -s /Users/<Your_User_Name>/Library/Developer/GStreamer/iPhone.sdk/GStreamer.framework ios/GStreamer.framework

Android

Follow GStreamer's Install on Android instuction, step Prerequisites and Download and install GStreamer binaries.

In Android, you need to init GStreamer in main activity of your flutter application. In your flutter application, edit MainActivity.kt or MainActivity.java file, depends on your flutter config (This file is usually located at android/app/src/main/<PATH_DEPPEND_ON_YOUR_FLUTTER_APPLICATION>/MainActivity.kt). Import GStreamer module and override onCreate of MainActivity class to init GStreamer, the end result should looks like bellow.

import org.freedesktop.gstreamer.GStreamer

class MainActivity: FlutterActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    GStreamer.init(this);
  }
}

This source code has been tested with GStreamer 1.20.1 prebuild binary

Getting Started

To start using the plugin, copy this code or follow the example project in example

import 'package:flutter/material.dart';

import 'package:flutter/services.dart';
import 'package:flutter_gstreamer_player/flutter_gstreamer_player.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: GstPlayer(
            pipeline:
              '''rtspsrc location=
                  rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4 !
                rtph264depay !
                h264parse !
                decodebin !
                videoconvert !
                video/x-raw,format=RGBA !
                appsink name=sink''',
          ),
        ),
      ),
    );
  }
}

License

Copyright (c) 2022, Nguyen Hoai Phong [email protected].

This library & work under this repository is licensed under MIT License.

flutter_gstreamer_player's People

Contributors

hpdragon1618 avatar ntvkhoasgt avatar shbae-musma avatar

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.