Skip to content

Commit

Permalink
RxFFmpeg 4.0.0
Browse files Browse the repository at this point in the history
5月迎来重大版本更新

1、新增自研RxFFmpegPlayer播放器内核基于(FFmpeg OpenGL OpenSL);
2、主打轻量级、高效、低功耗,播放本地视频秒开等特色;
3、涵盖播放器基本的 播放、暂停、快进、快退、循环播放、播放进度、加载状态等功能;
4、支持播放本地视频文件、在线视频、直播流(hls、rtmp、m3u8…)等;
5、项目里已集成OpenSSL所以也支持Https访问;
6、视频画面支持双指缩放、旋转、移动等手势操作;
  • Loading branch information
microshow committed May 8, 2020
1 parent c5ff832 commit 7f323fa
Show file tree
Hide file tree
Showing 33 changed files with 1,988 additions and 39 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Language: [English](README_EN.md)
| fdk-aac || 支持AAC音频编解码 |
| 格式转换 || 如: avi > mp4 > avi; mp3 > aac > mp3 等 |
| https || version >= 3.1.0 支持 https |
| [自研播放器](preview/docs/player.md) || RxFFmpegPlayer播放器主打轻量、高效、低功耗、视频秒开等特色 |
| [常用命令](preview/docs/cmd.md) || 持续更新 [点击查看](preview/docs/cmd.md) |


Expand Down Expand Up @@ -271,6 +272,23 @@ defaultConfig {
# 实验室

## [自研视频播放器RxFFmpegPlayer](preview/docs/player.md)

* 自研RxFFmpegPlayer播放器内核基于(FFmpeg OpenGL OpenSL)

* 主打轻量级、高效、低功耗,播放本地视频秒开等特色

* 涵盖播放器基本的 播放、暂停、快进、快退、循环播放、播放进度、加载状态等功能

* 支持播放本地视频文件、在线视频、直播流(hls、rtmp、m3u8…)等

* 项目里已集成OpenSSL所以也支持Https访问

* 视频画面支持双指缩放、旋转、移动等手势操作

<img src="/preview/icon/screen_player.gif" alt="图-1:screen_player.gif" width="240px"></img>


## 抖音首页视频翻页

* 视频适配方案
Expand Down
10 changes: 8 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">

<activity android:name="io.microshow.rxffmpeg.app.activity.LaunchActivity"
<activity
android:name="io.microshow.rxffmpeg.app.activity.LaunchActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Launcher">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -35,7 +38,10 @@
</intent-filter>
</activity>

<activity android:name="io.microshow.rxffmpeg.app.activity.MainActivity" />
<activity
android:name="io.microshow.rxffmpeg.app.activity.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="portrait" />


<!-- 记录崩溃日志 -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
package io.microshow.rxffmpeg.app.fragment;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;

import androidx.annotation.Nullable;
import io.microshow.rxffmpeg.app.R;
import io.microshow.rxffmpeg.app.databinding.FragmentFindBinding;
import io.microshow.rxffmpeg.player.MeasureHelper;
import io.microshow.rxffmpeg.player.RxFFmpegPlayerControllerImpl;
import io.microshow.rxffmpeg.player.RxFFmpegPlayerView;

/**
* 发现
* Created by Super on 2019/12/7.
*/
public class FindFragment extends BaseFragment<FragmentFindBinding> {
public class FindFragment extends BaseFragment<FragmentFindBinding> implements View.OnClickListener {

private RxFFmpegPlayerView mPlayerView;

@Override
public void onClick(View view) {
if (view.getId() == R.id.button) {
if (!TextUtils.isEmpty(binding.editText.getText().toString())) {
mPlayerView.play(binding.editText.getText().toString(), false);
}
}
}

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
Expand All @@ -24,22 +40,41 @@ public int initContentView() {

@Override
public void initData() {
//设置播放url
binding.editText.setText("https://aweme.snssdk.com/aweme/v1/playwm/?video_id=v0200fb40000bnvha302saj67106apf0&ratio=720p&line=0");
// binding.editText.setText("https://aweme.snssdk.com/aweme/v1/playwm/?video_id=v0300f7a0000bluavcsk9po2b28m1il0&ratio=720p&line=0");
// binding.editText.setText("/storage/emulated/0/1/1.mp4");
binding.button.setOnClickListener(this);

this.mPlayerView = binding.mPlayerView;

//设置控制层容器 和 视频尺寸适配模式
mPlayerView.setController(new RxFFmpegPlayerControllerImpl(getActivity()), MeasureHelper.FitModel.FM_DEFAULT);

//播放
binding.mPlayerView.play(binding.editText.getText().toString(), true);

}

@Override
public void onResume() {
super.onResume();
//恢复播放
mPlayerView.resume();
}

@Override
public void onPause() {
super.onPause();
//暂停视频
mPlayerView.pause();
}

@Override
public void onDestroy() {
super.onDestroy();
//销毁播放器
mPlayerView.release();
}

}
93 changes: 59 additions & 34 deletions app/src/main/res/layout/fragment_find.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,71 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:padding="16dp"
android:orientation="vertical">

<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="60dp"
app:cardBackgroundColor="@color/colorAccent"
app:cardCornerRadius="12dp"
app:contentPaddingLeft="30dp"
app:contentPaddingRight="30dp">
<io.microshow.rxffmpeg.player.RxFFmpegPlayerView
android:id="@+id/mPlayerView"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="音视频"
android:textColor="@android:color/white"
android:textSize="17sp" />

</androidx.cardview.widget.CardView>

<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="60dp"
app:cardBackgroundColor="@color/colorAccent"
android:layout_marginTop="16dp"
app:cardCornerRadius="12dp"
app:contentPaddingLeft="30dp"
app:contentPaddingRight="30dp">

<TextView
</io.microshow.rxffmpeg.player.RxFFmpegPlayerView>

<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="视频画面支持双指缩放、旋转、移动"
android:textColor="#999999"
android:textSize="12sp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp">

<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="抖音首页"
android:textColor="@android:color/white"
android:textSize="17sp" />
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="12dp"
app:contentPaddingBottom="2dp"
app:contentPaddingLeft="10dp"
app:contentPaddingRight="10dp"
app:contentPaddingTop="2dp">

<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="3" />

</androidx.cardview.widget.CardView>

<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_marginTop="20dp"
android:layout_gravity="end"
app:cardBackgroundColor="@color/colorAccent"
app:cardCornerRadius="22.5dp"
app:contentPaddingLeft="30dp"
app:contentPaddingRight="30dp">

<TextView
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="播放"
android:textColor="@android:color/white"
android:textSize="17sp" />

</androidx.cardview.widget.CardView>

</LinearLayout>

</androidx.cardview.widget.CardView>

</LinearLayout>

Expand Down
4 changes: 2 additions & 2 deletions configs.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ ext {
//支持包版本
supportLibValue = "28.0.0"
//应用 versionCode
versionCodeValue = 310
versionCodeValue = 400
//应用 version 名称,更多设置里显示的
versionNameValue = "3.1.0"
versionNameValue = "4.0.0"

}
Binary file modified preview/app-release.apk
Binary file not shown.
97 changes: 97 additions & 0 deletions preview/docs/player.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@

# RxFFmpegPlayer

>自研RxFFmpegPlayer播放器内核基于(FFmpeg OpenGL OpenSL);
主打轻量级、高效、低功耗,播放本地视频秒开等特色;
涵盖播放器基本的 播放、暂停、快进、快退、循环播放、播放进度、加载状态等功能;
支持播放本地视频文件、在线视频、直播流(hls、rtmp、m3u8…)等;
项目里已集成OpenSSL所以也支持Https访问;
视频画面支持双指缩放、旋转、移动等手势操作;


# 特色功能

* **自研RxFFmpegPlayer播放器内核基于(FFmpeg OpenGL OpenSL)**

* **主打轻量级、高效、低功耗,播放本地视频秒开等特色**

* **涵盖播放器基本的 播放、暂停、快进、快退、循环播放、播放进度、加载状态等功能**

* **支持播放本地视频文件、在线视频、直播流(hls、rtmp、m3u8…)等**

* **项目里已集成OpenSSL所以也支持Https访问**

* **视频画面支持双指缩放、旋转、移动等手势操作**


# 使用方式

```java

public class FindFragment extends BaseFragment<FragmentFindBinding> implements View.OnClickListener {

private RxFFmpegPlayerView mPlayerView;

@Override
public void onClick(View view) {
if (view.getId() == R.id.button) {
if (!TextUtils.isEmpty(binding.editText.getText().toString())) {
mPlayerView.play(binding.editText.getText().toString(), false);
}
}
}

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}

@Override
public int initContentView() {
return R.layout.fragment_find;
}

@Override
public void initData() {
//设置播放url
binding.editText.setText("/storage/emulated/0/1/1.mp4");
binding.button.setOnClickListener(this);

this.mPlayerView = binding.mPlayerView;

//设置控制层容器 和 视频尺寸适配模式
mPlayerView.setController(new RxFFmpegPlayerControllerImpl(getActivity()), MeasureHelper.FitModel.FM_DEFAULT);

//播放
binding.mPlayerView.play(binding.editText.getText().toString(), true);

}

@Override
public void onResume() {
super.onResume();
//恢复播放
mPlayerView.resume();
}

@Override
public void onPause() {
super.onPause();
//暂停视频
mPlayerView.pause();
}

@Override
public void onDestroy() {
super.onDestroy();
//销毁播放器
mPlayerView.release();
}

}
```


# ScreenShot

<img src="/preview/icon/screen_player.gif" alt="图-1:screen_player.gif" width="240px"></img>
Binary file added preview/icon/screen_player.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified rxffmpeg/libs/arm64-v8a/librxffmpeg-invoke.so
Binary file not shown.
Binary file added rxffmpeg/libs/arm64-v8a/librxffmpeg-player.so
Binary file not shown.
Binary file modified rxffmpeg/libs/armeabi-v7a/librxffmpeg-invoke.so
Binary file not shown.
Binary file added rxffmpeg/libs/armeabi-v7a/librxffmpeg-player.so
Binary file not shown.
Binary file modified rxffmpeg/libs/x86/librxffmpeg-invoke.so
Binary file not shown.
Binary file added rxffmpeg/libs/x86/librxffmpeg-player.so
Binary file not shown.
Binary file modified rxffmpeg/libs/x86_64/librxffmpeg-invoke.so
Binary file not shown.
Binary file added rxffmpeg/libs/x86_64/librxffmpeg-player.so
Binary file not shown.
Loading

0 comments on commit 7f323fa

Please sign in to comment.