androidijk播放器,[流媒体]ijkplayer播放器,android平台使用说明

androidijk播放器,[流媒体]ijkplayer播放器,android平台使⽤说
ijkplayer 编译
编译可以参考官⽅说明
简要步骤说明:
隧道定位
将代码下载到本地
设定ndk环境
下载对应平台的ndk⼯具包,官⽹地址
设置ndk的编译环境,因为我使⽤的是mac,就直接
export ANDROID_NDK=/ndk-path
初始化ijkplayer为android编译环境
.
/init-android.sh
编译ffmpeg之前准备
因为ijkplayer还是依赖于ffmpeg的⼀些功能,所以在进⾏ijkplayer的编译之前,⾸先需要满⾜ffmpeg的编译条件。最主要的就是yasm的安装,以mac为例,安装yasm
brew install yasm
开始编译ffmpeg
cd android/contrib
./compile-ffmpeg.sh clean
微安表./compile-ffmpeg.sh all
编译ijkplayer
./compile-ijk.sh all
ijkplayer 的使⽤
使⽤前的说明
在完成上⾯的编译过程之后,可以在ijkplayer中发现⼀个android⼯程,简要的⽬录如下:
+---/path-to-ijkplayer/android/ijkplayer
|
+---ijkplayer-arm64
|
+---ijkplayer-armv5
|
+---ijkplayer-armv7a
|
+---ijkplayer-x86-64
|
+---ijkplayer-java
|
u型玻璃幕墙
+---ijkplayer-exo
|
+---tools
如上⽬录为ijkplayer在android平台上需要⽤到的库,从命名上可以看出,以上modules中包含了这⼏类:ijkplayer-arm*和ijkplayer-x86*,实现了不同平台下的so库。
ijkplayer-java和ijkplayer-exo, 为封装好的ijkplayer的java层api。
tools,编译需要⽤到的脚本程序
如何使⽤
新建android⼯程,命名为:ijkplayer-demo。
讲上⽂中表⽰出来的⽂件夹全部拷贝到新建的android⼯程⽬录下。
修改新建⼯程中的adle:
include ':ijkplayer-armv5', ':ijkplayer-x86_64'
include ':ijkplayer-armv7a'
include ':ijkplayer-arm64'
include ':ijkplayer-x86'
include ':ijkplayer-java'
include ':ijkplayer-exo'
include ':app'
修改/adle
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'ls.build:gradle:2.3.3'
19rrr
// NOTE: Do not place your application dependencies here; they belong
// in the individual adle files
allprojects {
repositories {
jcenter()
}
}
ext {
compileSdkVersion = 23
buildToolsVersion = "23.0.3"
targetSdkVersion = 23
versionCode = 800000
versionName = "0.8.0"
}
task clean(type: Delete) {
delete rootProject.buildDir
}
修改/path-to-ijkplayer-demp/adle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "st.ijkplayer.hankun.ijkplayer_test"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "st.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(''), 'proguard-rules.pro'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.st.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.straint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile project(':ijkplayer-java')
compile project(':ijkplayer-arm64')
compile project(':ijkplayer-armv5')
compile project(':ijkplayer-armv7a')
compile project(':ijkplayer-x86')
compile project(':ijkplayer-x86_64')
}
给app添加权限
```
app的布局⽂件
xmlns:app="schemas.android/apk/res-auto"
xmlns:tools="schemas.android/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="st.ijkplayer.hankun.ijkplayer_test.MainActivity">
android:layout_width="368dp"
android:layout_height="495dp"
tools:layout_editor_absoluteY="8dp"
tools:layout_editor_absoluteX="8dp">
android:id="@+id/button_prepare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
android:id="@+id/show_screen"
android:layout_width="400dp"
android:layout_height="200dp"
android:layout_below="@+id/button_prepare"
/>
MainActivity代码
st.ijkplayer.hankun.ijkplayer_test;
t.Context;
aphics.SurfaceTexture;
import android.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Surface;
import android.view.TextureView;
import android.view.View;
import android.widget.Button;步进式加热炉
stimulsoft
import tv.dia.player.IMediaPlayer;
import tv.dia.player.IjkMediaPlayer;
public class MainActivity extends AppCompatActivity {
private String source_url = "rtsp://192.168.1.106:8554/test.mkv";
private Context _ctx = this;
public IjkMediaPlayer player = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
player = new IjkMediaPlayer();
TextureView tv = (TextureView)findViewById(R.id.show_screen);
tv.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {

本文发布于:2024-09-24 22:33:00,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/1/151807.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:编译   平台   环境   下载   需要   新建   播放器
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议