VideoReverse接入基类Activity

VideoReverse接入基类Activity
pull/107/head
xufulong 5 years ago
parent c359d03195
commit 6f5e074c95
  1. 6
      app/src/main/AndroidManifest.xml
  2. 1
      app/src/main/java/com/frank/ffmpeg/activity/PushActivity.java
  3. 36
      app/src/main/java/com/frank/ffmpeg/activity/VideoReverseActivity.java
  4. 1
      app/src/main/res/values/strings.xml

@ -44,8 +44,7 @@
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<!-- 本地推流直播 --> <!-- 本地推流直播 -->
<activity <activity
android:name=".activity.PushActivity" android:name=".activity.PushActivity" />
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar" />
<!-- 实时推流直播 --> <!-- 实时推流直播 -->
<activity <activity
android:name=".activity.LiveActivity" android:name=".activity.LiveActivity"
@ -57,8 +56,7 @@
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<!--视频倒播--> <!--视频倒播-->
<activity android:name=".activity.VideoReverseActivity" <activity android:name=".activity.VideoReverseActivity"
android:screenOrientation="landscape" android:screenOrientation="landscape" />
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar" />
<!--申请悬浮窗权限--> <!--申请悬浮窗权限-->
<activity android:name=".floating.FloatActivity" <activity android:name=".floating.FloatActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"

@ -34,6 +34,7 @@ public class PushActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
hideActionBar();
initView(); initView();
} }

@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
import android.os.Environment; import android.os.Environment;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@ -21,11 +20,11 @@ import java.io.File;
* Created by frank on 2018/9/12. * Created by frank on 2018/9/12.
*/ */
public class VideoReverseActivity extends AppCompatActivity { public class VideoReverseActivity extends BaseActivity {
private final static String TAG = VideoReverseActivity.class.getSimpleName(); private final static String TAG = VideoReverseActivity.class.getSimpleName();
private final static String ROOT_PATH = Environment.getExternalStorageDirectory().getPath(); private final static String ROOT_PATH = Environment.getExternalStorageDirectory().getPath();
private final static String VIDEO_NORMAL_PATH = ROOT_PATH + File.separator + "beyond.mp4"; private String VIDEO_NORMAL_PATH = "";
private final static String VIDEO_REVERSE_PATH = ROOT_PATH + File.separator + "reverse.mp4"; private final static String VIDEO_REVERSE_PATH = ROOT_PATH + File.separator + "reverse.mp4";
private LinearLayout loading; private LinearLayout loading;
@ -33,6 +32,7 @@ public class VideoReverseActivity extends AppCompatActivity {
private VideoView videoReverse; private VideoView videoReverse;
private final static int MSG_PLAY = 7777; private final static int MSG_PLAY = 7777;
private final static int MSG_TOAST = 8888;
@SuppressLint("HandlerLeak") @SuppressLint("HandlerLeak")
private Handler mHandler = new Handler(){ private Handler mHandler = new Handler(){
@Override @Override
@ -41,25 +41,31 @@ public class VideoReverseActivity extends AppCompatActivity {
if (msg.what == MSG_PLAY){ if (msg.what == MSG_PLAY){
changeVisibility(); changeVisibility();
startPlay(); startPlay();
}else if (msg.what == MSG_TOAST) {
showToast(getString(R.string.please_click_select));
} }
} }
}; };
@Override
int getLayoutId() {
return R.layout.activity_video_reverse;
}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_reverse);
initView(); initView();
initPlayer(); initPlayer();
videoReverse(); mHandler.sendEmptyMessageDelayed(MSG_TOAST, 1000);
} }
private void initView() { private void initView() {
loading = (LinearLayout) findViewById(R.id.layout_loading); loading = getView(R.id.layout_loading);
videoNormal = (VideoView) findViewById(R.id.video_normal); videoNormal = getView(R.id.video_normal);
videoReverse = (VideoView) findViewById(R.id.video_reverse); videoReverse = getView(R.id.video_reverse);
loading.setVisibility(View.GONE);
} }
private void changeVisibility(){ private void changeVisibility(){
@ -81,7 +87,6 @@ public class VideoReverseActivity extends AppCompatActivity {
videoReverse.start(); videoReverse.start();
} }
/** /**
* 执行ffmpeg命令行 * 执行ffmpeg命令行
* @param commandLine commandLine * @param commandLine commandLine
@ -115,4 +120,15 @@ public class VideoReverseActivity extends AppCompatActivity {
executeFFmpegCmd(commandLine); executeFFmpegCmd(commandLine);
} }
@Override
void onViewClick(View view) {
}
@Override
void onSelectedFile(String filePath) {
VIDEO_NORMAL_PATH = filePath;
loading.setVisibility(View.VISIBLE);
videoReverse();
}
} }

@ -65,5 +65,6 @@
<string name="select_file">选择文件</string> <string name="select_file">选择文件</string>
<string name="please_select">请选择正确文件</string> <string name="please_select">请选择正确文件</string>
<string name="file_not_found">文件不存在</string> <string name="file_not_found">文件不存在</string>
<string name="please_click_select">请点击右上角菜单选择文件</string>
</resources> </resources>

Loading…
Cancel
Save