From 4f08770cf0e93b8de8f20ddc96ffe4885b678353 Mon Sep 17 00:00:00 2001 From: xufulong <839789740@qq.com> Date: Tue, 3 Dec 2019 00:11:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=80=92=E6=92=ADactivity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 去掉倒播activity --- app/src/main/AndroidManifest.xml | 3 - .../frank/ffmpeg/activity/LiveActivity.java | 2 +- .../frank/ffmpeg/activity/MainActivity.java | 4 - .../ffmpeg/activity/VideoReverseActivity.java | 118 ------------------ app/src/main/res/layout/activity_main.xml | 11 +- .../main/res/layout/activity_video_handle.xml | 3 +- .../res/layout/activity_video_reverse.xml | 34 ----- 7 files changed, 4 insertions(+), 171 deletions(-) delete mode 100644 app/src/main/java/com/frank/ffmpeg/activity/VideoReverseActivity.java delete mode 100644 app/src/main/res/layout/activity_video_reverse.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index fd67a73..5b15bca 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -48,9 +48,6 @@ - - diff --git a/app/src/main/java/com/frank/ffmpeg/activity/LiveActivity.java b/app/src/main/java/com/frank/ffmpeg/activity/LiveActivity.java index 8b3740b..8d2758a 100644 --- a/app/src/main/java/com/frank/ffmpeg/activity/LiveActivity.java +++ b/app/src/main/java/com/frank/ffmpeg/activity/LiveActivity.java @@ -28,7 +28,7 @@ import com.frank.live.param.VideoParam; public class LiveActivity extends BaseActivity implements CompoundButton.OnCheckedChangeListener, LiveStateChangeListener { private final static String TAG = LiveActivity.class.getSimpleName(); - private final static String LIVE_URL = "rtmp://192.168.1.102/live/stream"; + private final static String LIVE_URL = "rtmp://192.168.1.3/live/stream"; private final static int MSG_ERROR = 100; private SurfaceHolder surfaceHolder; private LivePusher livePusher; diff --git a/app/src/main/java/com/frank/ffmpeg/activity/MainActivity.java b/app/src/main/java/com/frank/ffmpeg/activity/MainActivity.java index 913e686..cb953f3 100644 --- a/app/src/main/java/com/frank/ffmpeg/activity/MainActivity.java +++ b/app/src/main/java/com/frank/ffmpeg/activity/MainActivity.java @@ -30,7 +30,6 @@ public class MainActivity extends BaseActivity { R.id.btn_push, R.id.btn_live, R.id.btn_filter, - R.id.btn_reverse, R.id.btn_preview ); } @@ -60,9 +59,6 @@ public class MainActivity extends BaseActivity { case R.id.btn_filter://滤镜特效 intent.setClass(MainActivity.this, FilterActivity.class); break; - case R.id.btn_reverse://视频倒播 - intent.setClass(MainActivity.this, VideoReverseActivity.class); - break; case R.id.btn_preview://视频拖动实时预览 intent.setClass(MainActivity.this, VideoPreviewActivity.class); break; diff --git a/app/src/main/java/com/frank/ffmpeg/activity/VideoReverseActivity.java b/app/src/main/java/com/frank/ffmpeg/activity/VideoReverseActivity.java deleted file mode 100644 index 09cec47..0000000 --- a/app/src/main/java/com/frank/ffmpeg/activity/VideoReverseActivity.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.frank.ffmpeg.activity; - -import android.annotation.SuppressLint; -import android.os.Environment; -import android.os.Handler; -import android.os.Message; -import android.os.Bundle; -import android.view.View; -import android.widget.LinearLayout; -import android.widget.VideoView; -import com.frank.ffmpeg.R; -import com.frank.ffmpeg.handler.FFmpegHandler; -import com.frank.ffmpeg.util.FFmpegUtil; -import com.frank.ffmpeg.util.FileUtil; -import java.io.File; - -import static com.frank.ffmpeg.handler.FFmpegHandler.MSG_FINISH; -import static com.frank.ffmpeg.handler.FFmpegHandler.MSG_TOAST; - -/** - * 先处理视频反序,再视频倒播 - * Created by frank on 2018/9/12. - */ - -public class VideoReverseActivity extends BaseActivity { - - private final static String ROOT_PATH = Environment.getExternalStorageDirectory().getPath(); - private String VIDEO_NORMAL_PATH = ""; - private final static String VIDEO_REVERSE_PATH = ROOT_PATH + File.separator + "reverse.mp4"; - - private LinearLayout loading; - private VideoView videoReverse; - private FFmpegHandler ffmpegHandler; - - @SuppressLint("HandlerLeak") - private Handler mHandler = new Handler(){ - @Override - public void handleMessage(Message msg) { - super.handleMessage(msg); - if (msg.what == MSG_FINISH){ - changeVisibility(); - startPlay(); - } else if (msg.what == MSG_TOAST) { - showToast(getString(R.string.please_click_select)); - } - } - }; - - @Override - int getLayoutId() { - return R.layout.activity_video_reverse; - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - initView(); - initPlayer(); - mHandler.sendEmptyMessageDelayed(MSG_TOAST, 500); - ffmpegHandler = new FFmpegHandler(mHandler); - } - - private void initView() { - loading = getView(R.id.layout_loading); - videoReverse = getView(R.id.video_reverse); - loading.setVisibility(View.GONE); - } - - private void changeVisibility(){ - loading.setVisibility(View.GONE); - videoReverse.setVisibility(View.VISIBLE); - } - - private void initPlayer(){ - videoReverse.setVideoPath(VIDEO_REVERSE_PATH); - } - - /** - * 开始视频倒播 - */ - private void startPlay(){ - videoReverse.start(); - } - - /** - * 视频反序处理 - */ - private void videoReverse(){ - if (!FileUtil.checkFileExist(VIDEO_NORMAL_PATH)){ - return; - } - String[] commandLine = FFmpegUtil.reverseVideo(VIDEO_NORMAL_PATH, VIDEO_REVERSE_PATH); - if (ffmpegHandler != null) { - ffmpegHandler.executeFFmpegCmd(commandLine); - } - } - - @Override - void onViewClick(View view) { - - } - - @Override - void onSelectedFile(String filePath) { - VIDEO_NORMAL_PATH = filePath; - loading.setVisibility(View.VISIBLE); - videoReverse(); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - if (mHandler != null) { - mHandler.removeCallbacksAndMessages(null); - } - } -} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index d8af25c..a56038b 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -65,15 +65,6 @@ android:layout_centerHorizontal="true" android:layout_below="@+id/btn_live"/> -