android video player base on ijkplayer

Related tags

Media GiraffePlayer
Overview

GiraffePlayer

NOTE:this project is no longer update please using improved GiraffePlayer2 ,for flutter please visit GPlayer


out of the box android video player base on ijkplayer

note: if the player can't play your video,try download full-featured so which support more codec/format (bigger binary size) to replace ijkplayer-java/src/main/jniLibs (I have try to push a new branch to github but failed)

features

  1. base on ijkplayer,support RTMP , HLS (http & https) , MP4,M4A etc.
  2. gestures for volume control
  3. gestures for brightness control
  4. gestures for forward or backward
  5. fullscreen by manual or sensor
  6. try to replay when error(only for live video)
  7. set video scale type (double click video will switch the scale types in app,you can find the difference)
    1. fitParent:scale the video uniformly (maintain the video's aspect ratio) so that both dimensions (width and height) of the video will be equal to or less than the corresponding dimension of the view. like ImageView's CENTER_INSIDE.等比缩放,画面填满view。
    2. fillParent:scale the video uniformly (maintain the video's aspect ratio) so that both dimensions (width and height) of the video will be equal to or larger than the corresponding dimension of the view .like ImageView's CENTER_CROP.等比缩放,直到画面宽高都等于或小于view的宽高。
    3. wrapContent:center the video in the view,if the video is less than view perform no scaling,if video is larger than view then scale the video uniformly so that both dimensions (width and height) of the video will be equal to or less than the corresponding dimension of the view. 将视频的内容完整居中显示,如果视频大于view,则按比例缩视频直到完全显示在view中。
    4. fitXY:scale in X and Y independently, so that video matches view exactly.不剪裁,非等比例拉伸画面填满整个View
    5. 16:9:scale x and y with aspect ratio 16:9 until both dimensions (width and height) of the video will be equal to or less than the corresponding dimension of the view.不剪裁,非等比例拉伸画面到16:9,并完全显示在View中。
    6. 4:3:scale x and y with aspect ratio 4:3 until both dimensions (width and height) of the video will be equal to or less than the corresponding dimension of the view.不剪裁,非等比例拉伸画面到4:3,并完全显示在View中。

how to import library

  1. git clone https://github.com/tcking/GiraffePlayer.git
  2. android studio->file->New->Import module->select giraffeplayer

notice:

the player default support 6 CPU architecture:ARMv5, ARMv7, ARMv8,x86 and 86_64,if your project need't support all of the architectures,you can remove the folder in ijkplayer-java/src/main/jniLibs to generate a light APK. read this first:How to use 32-bit native libaries on 64-bit Android device,What you should know about .so files,关于Android的.so文件你所需要知道的

How to use (example code)

case 1: only want to play a video fullscreen

just callGiraffePlayerActivity.configPlayer(activity).play(url),all is done.

case 2: embed a player in a layout

step 1: include video layout in your layout xml file

<include
        layout="@layout/giraffe_player"
        android:layout_width="match_parent"
        android:layout_height="210dp"/>

notice:the giraffe player is match_parent default,if you want to specify height or width you can overwrite layout_width and layout_width in include tag

step 2: new player and call play

GiraffePlayer player = new GiraffePlayer(activity);
player.play(url);

API:

  • play(url) //play video
  • stop() //stop play
  • pause()
  • start()
  • forward() // forward or back,example: forward(0.1f) forward(-0.1f)
  • getCurrentPosition()
  • setScaleType(GiraffePlayer.SCALETYPE_FITPARENT) //set video scale type
  • toggleAspectRatio() // toggle video scale type
  • seekTo(...) //seek to specify position
  • getDuration() //get video duration
  • onInfo(...) //callback when have some information
  • onError(...) //callback when an error occurred
  • onComplete(...) //callback when the play is over
  • onControlPanelVisibilityChange(...) //callback when control panel visibility change

screencap

Comments
  • OpenSSL: https protocol not found

    OpenSSL: https protocol not found

    Im using the latest version and still getting:

    "https protocol not found recompile FFmpeg with openssl, gnutls, or securetransport enabled."

    even after this: https://github.com/tcking/GiraffePlayer/releases/tag/0.3

    how can I fix it?

    opened by migueltarga 13
  • rtmp

    rtmp

    Hello again.

    I have a small problem . If using RTMP goes perfectly, but if RTMP is "rtmp://1111.11111.1111.11/live swfUrl=http://web/swf/WebTV.swf playpath=wt_2plus.stream" not working. I can not find the problem.

    opened by AppNetDeveloper 6
  • native crash at /system/lib/libc.so

    native crash at /system/lib/libc.so

    Hi, Im using this library im my published app, and its great, but after last update i started receiving many complaints from users, player does not work for them, Below is stack trace from google developer console.

    Note: i updated library 3 days ago because of OpenSSL version. and problem started after the update, but not on all devices, i tried on two handsets and some emulators and didnt face it, but in google play report, hundreds of users have this issue in the last 3 days.

    Build fingerprint: 'samsung/j1aceltexx/j1acelte:4.4.4/KTU84P/J110FXXU0APB1:user/release-keys' Revision: '1' pid: 2203, tid: 2337, name: ff_read >>> info...* <<< signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad Abort message: 'invalid address or address of corrupt block 0xab7483e8 passed to dlfree' r0 00000000 r1 4006761e r2 deadbaad r3 4006b19e r4 ab7483e8 r5 40076180 r6 4dd4c000 r7 ab7483f0 r8 ab66c920 r9 ab3e3c7c sl 000000bc fp ab3e2b60 ip 00000001 sp 60c1b2c0 lr 400387a3 pc 400387a4 cpsr 60000030 d0 2064657373617064 d1 6120726f2073736c d2 6f20737365726466 d3 707572726f632072 d4 0000000100000001 d5 0000000000000000 d6 0000000000000829 d7 000000000009349c d8 4347000040e00000 d9 00000000434e0000 d10 0000000000000000 d11 0000000000000000 d12 0000000000000000 d13 0000000000000000 d14 0000000000000000 d15 0000000000000000 d16 3fef3b96a293e600 d17 400fcee5a8a4f980 d18 416312d000000000 d19 be5ae5e49f7a3d66 d20 40032e4a2a741b9f d21 4037f9dcb5112287 d22 3f1675761676a000 d23 3eddf1e79327e23d d24 3e15043a2804671b d25 fefefefefefefefe d26 4037f9dcb5112287 d27 400abcdf01234bb8 d28 3ff0000000000000 d29 007f007f007f007f d30 ffffffffffffffff d31 4000000000000000 scr 28000010

    backtrace: #00 pc 000117a4 /system/lib/libc.so (dlfree+1191) #01 pc 0000dcfb /system/lib/libc.so (free+10) #02 pc 001e028d /data/app-lib/info...*-2/libijkffmpeg.so (ffurl_closep+40)

    code around pc: 40038784 6a014478 62021e4a f7fdb95a e008fd41 40038794 4a2b482a 447a4478 f0014621 4a13f9af 400387a4 49286014 f8d14479 079a31bc f501d51c 400387b4 e8bd70e0 f02c40f8 4823bb5b f7fd4478 400387c4 4822fd15 e7fa4478 42b7688f ae10f43f 400387d4 481fe611 e7f24478 4478481e 6888e7ef 400387e4 f43f4298 e606aed4 bf00bdf8 deadbaad 400387f4 0003de6e 0003de60 0003ddc4 00032d9c 40038804 0003dd3c 0003dd2a 0003dcb2 0003dc90 40038814 0003dc30 0003dc1e 0003dbb8 0003dba0 40038824 0003db8e 0003db38 0003db10 0003da84 40038834 0003da30 0003da16 0003d9f8 0002ee82 40038844 00032a00 0003d9d4 000329da 000329d2 40038854 000329c2 000329bc b168b538 0300ea41 40038864 04150c1a f401fb00 fbb4b13d 4288f0f0 40038874 f04fbf18 e00034ff 46204604 fb16f7fe

    code around lr: 40038780 482e61a3 6a014478 62021e4a f7fdb95a 40038790 e008fd41 4a2b482a 447a4478 f0014621 400387a0 4a13f9af 49286014 f8d14479 079a31bc 400387b0 f501d51c e8bd70e0 f02c40f8 4823bb5b 400387c0 f7fd4478 4822fd15 e7fa4478 42b7688f 400387d0 ae10f43f 481fe611 e7f24478 4478481e 400387e0 6888e7ef f43f4298 e606aed4 bf00bdf8 400387f0 deadbaad 0003de6e 0003de60 0003ddc4 40038800 00032d9c 0003dd3c 0003dd2a 0003dcb2 40038810 0003dc90 0003dc30 0003dc1e 0003dbb8 40038820 0003dba0 0003db8e 0003db38 0003db10 40038830 0003da84 0003da30 0003da16 0003d9f8 40038840 0002ee82 00032a00 0003d9d4 000329da 40038850 000329d2 000329c2 000329bc b168b538 40038860 0300ea41 04150c1a f401fb00 fbb4b13d 40038870 4288f0f0 f04fbf18 e00034ff 46204604

    Thanks for the great lib, and thanks for your support

    opened by HazimSharif 5
  • "UnsatisfiedLinkError" on ARM 64 BIt devices.

    When I try to play any video In one of my device which have Qualcomm MSM8916 Snapdragon 410 64bit processor GiraffePlayer showing the Player not support this device error and in logcat I'm getting this:

    java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader [DexPathList[[zip file "/data/app/com.conx.helper-1/base.apk"],nativeLibraryDirectories=[/data/app/com.conx.helper-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libijkffmpeg.so" at java.lang.Runtime.loadLibrary(Runtime.java:366) at java.lang.System.loadLibrary(System.java:988) at tv.danmaku.ijk.media.player.IjkMediaPlayer$1.loadLibrary(IjkMediaPlayer.java:144) at tv.danmaku.ijk.media.player.IjkMediaPlayer.loadLibrariesOnce(IjkMediaPlayer.java:155) at tcking.github.com.giraffeplayer.GiraffePlayer.<init>(GiraffePlayer.java:263) at tcking.github.com.giraffeplayer.GiraffePlayerActivity.onCreate(GiraffePlayerActivity.java:30) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2311) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2420) at android.app.ActivityThread.access$900(ActivityThread.java:154) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5292) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)

    But on other device which have Mediatek MT6753 which is also a 64bit processor, videos are playing fine. Can you please look at this issue as most of the android device nowadays are equipped with a 64 bit processor. Thanks.

    opened by vipulpurohit 4
  • .avi not work

    .avi not work

    very good this player. but not going to .avi? and another question how can I do to make zoom? there do not understand the explanation, can say in English?

    opened by AppNetDeveloper 4
  • m3u suport?

    m3u suport?

    Hello

    What can I do to use and M3U? at the moment M3U crashes.

    Please do not forget to add more portions api for resolution and progress would be perfect.

    opened by AppNetDeveloper 3
  • "Protocol not found" for YouTube link.

    Hello, FIrst of all thanks for this amazing library. I'm trying to play YouTube link https://www.youtube.com/watch?v=ITEXG22Y0MY in the player but I'm getting "Protocol not found" error in ijkPlayer. I know this is openssl issue and I think we need to compile ijkPlayer with openssl. I was trying to fix it myself but I'm on windows machine and don't have any linux or Mac to compile ijkPlayer. Can you please fix this issue so GiraffePlayer can play youtube link also.

    Thanks

    opened by vipulpurohit 2
  • Playing UDP over HTTP support?

    Playing UDP over HTTP support?

    Hi developers, just had a try out to use this player to play several types of protocols, and i have found out that. Player has crashed trying to play this url. http://95.30.149.67:2002/udp/233.33.210.6:5050 It trying to play but eventually it goes bang, if you have an solution to play such us stream, that would be great to hear. (btw. i have used extended liblaries downloaded from the top of readme file and used example app to play them)

    Thanks for any help. Regards.

    opened by SuperUserek 1
  • MOV 格式的视频播放失败

    MOV 格式的视频播放失败

    Couldn't open https://*****.cn/15606539026033.MOV: java.io.FileNotFoundException: No content provider: https://****.cn/15606539026033.MOV

    会吐司提示:Player encountered a small problem

    opened by LayneCui 0
Releases(0.8)
Owner
tom
tom
Cache support for any video player with help of single line

Video cache support for Android Table of Content Why AndroidVideoCache? Features Get started Recipes Disk cache limit Listen caching progress Providin

Alexey Danilov 5.1k Dec 26, 2022
MJPEG video streaming on Android

ipcam-view Android MJPEG video streaming made simple! A wrapper library around the well known SimpleMjpegView and android-camera-axis projects. If you

null 359 Jan 6, 2023
Convert video to GIF. Simple and fast.

Convert video to GIF. Simple and fast.

tasy5kg 24 Nov 26, 2022
[] Easily integrate Camera features into your Android app

Deprecated CameraView is deprecated. No more development will be taking place. Use Jetpack CameraX instead. CameraView This is not an official Google

Google 4.8k Dec 29, 2022
A solution for streaming H.264, H.263, AMR, AAC using RTP on Android

Introduction What it does libstreaming is an API that allows you, with only a few lines of code, to stream the camera and/or microphone of an android

Simon 3.3k Dec 30, 2022
[] FFmpeg build for android random architectures with example jni

AndroidFFmpegLibrary This project aims to create working library providing playing video files in android via ffmpeg libraries. With some effort and N

AppUnite Sp. z o.o. Spk. 1k Mar 1, 2021
a system for building custom ffmpeg binaries for Android

This is a new android-ffmpeg project since it seems there were so many different ways of doing it, it was confusing. So here is my clean, easily chan

Guardian Project 967 Nov 12, 2022
Android Java wrapper around ffmpeg command line binary

FFMPEG Library for Android This project is a Java wrapper around an ffmpeg command line binary for use in Android applications. It depends on the andr

Guardian Project 555 Dec 5, 2022
script(s) to build ffmpeg for android, including support for RTMP (and OpenSSL)

android-ffmpeg-with-rtmp This repository contains script(s) to build ffmpeg for android with RTMP (and OpenSSL) support. Instructions Install the Andr

cine.io 234 Dec 28, 2022
Script and Instructions for building FFmpeg for Android

FFmpeg-Android Herein lies scripts and instructions for compiling FFmpeg for Android with RTMP support. Much thanks to Chris Ballinger and Liu Feipeng

David Brodsky 80 Dec 13, 2022
Convert audio files inside your Android app easily. Supported formats: AAC, MP3, M4A, WMA, WAV and FLAC.

AndroidAudioConverter Convert audio files inside your Android app easily. This is a wrapper of FFmpeg-Android-Java lib. Supported formats: AAC MP3 M4A

Adriel Café 1.3k Jan 5, 2023
A mod of the Twitch Android Mobile App adding BetterTTV and FrankerFaceZ emotes

A mod of the Twitch Android Mobile App adding BetterTTV and FrankerFaceZ emotes

null 377 Jan 2, 2023
Android MoveNet single human pose estimation by ncnn

Android MoveNet single human pose estimation by ncnn

FeiGeChuanShu 93 Dec 31, 2022
Yet Another Video Player (or YAVP) is a Video Player for Android that is based on Googles ExoPlayer.

Yet Another Video Player Yet Another Video Player (or YAVP) is a Video Player for Android that is based on Googles ExoPlayer. Who Is YAVP For? First o

null 62 Dec 29, 2022
Compose-video-player - Video player for Android Compose powered by ExoPlayer

Compose Video Player Video player for Android Compose powered by ExoPlayer. Addi

Juan Pablo Herrera 22 Dec 13, 2022
Permanently moved to http://github.com/Bilibili/ijkplayer

ijkplayer Platform Build Status Android iOS Video player based on ffplay Download Android: Gradle # required allprojects { repositories {

bbcallen 35 Oct 24, 2022
Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface.

Fermata Media Player About Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface. It is focused on

Andrey 227 Jan 6, 2023
1aingenieriaygas native base android - Project base for the migration of the Flutter App of 1A Ingenieria y Gas

1A Ingenieria y Gas App Versión Wordpress Backend Este proyecto se encuentra sol

Paul Osinga 1 Jan 26, 2022
Base App - MVVM, Base Structure, Hilt, Kotlin Flow, Retrofit

Base App - MVVM, Base Structure, Hilt, Kotlin Flow, Retrofit

Kerem TÜRKER 39 Nov 17, 2022