diff --git a/OnLive/.gitignore b/OnLive/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/OnLive/.gitignore @@ -0,0 +1 @@ +/build diff --git a/OnLive/src/main/java/com/frank/living/activity/RtspLiveActivity.java b/OnLive/src/main/java/com/frank/living/activity/RtspLiveActivity.java index c7ee548..74e7524 100644 --- a/OnLive/src/main/java/com/frank/living/activity/RtspLiveActivity.java +++ b/OnLive/src/main/java/com/frank/living/activity/RtspLiveActivity.java @@ -3,18 +3,24 @@ package com.frank.living.activity; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; +import android.view.View; +import android.widget.ImageButton; import android.widget.TableLayout; import com.frank.living.R; import com.frank.living.listener.IjkPlayerListener; import tv.danmaku.ijk.media.player.IjkMediaPlayer; import com.frank.living.widget.IjkVideoView; -public class RtspLiveActivity extends AppCompatActivity implements IjkPlayerListener{ +public class RtspLiveActivity extends AppCompatActivity implements IjkPlayerListener, View.OnClickListener{ private final static String TAG = RtspLiveActivity.class.getSimpleName(); private IjkMediaPlayer ijkMediaPlayer; private IjkVideoView mVideoView; + private ImageButton btnPlay; + private ImageButton btnSound; + private boolean isPause; + private boolean isSilence; private final static String url = "rtsp://184.72.239.149/vod/mp4://BigBuckBunny_175k.mov"; @@ -37,6 +43,12 @@ public class RtspLiveActivity extends AppCompatActivity implements IjkPlayerList mVideoView.setIjkPlayerListener(this); mVideoView.setVideoPath(url); mVideoView.start(); + + btnPlay = (ImageButton) findViewById(R.id.btn_play); + btnPlay.setOnClickListener(this); + btnSound = (ImageButton) findViewById(R.id.btn_sound); + btnSound.setOnClickListener(this); + } private void initOptions(){ @@ -68,6 +80,36 @@ public class RtspLiveActivity extends AppCompatActivity implements IjkPlayerList initOptions(); } + @Override + public void onClick(View v) { + switch (v.getId()){ + case R.id.btn_play: + isPause = !isPause; + if (isPause){//直播暂停 + mVideoView.pause(); + btnPlay.setBackgroundResource(R.drawable.ic_play); + }else {//直播继续 + mVideoView.start(); + btnPlay.setBackgroundResource(R.drawable.ic_pause); + } + break; + case R.id.btn_sound: + isSilence = !isSilence; + if (ijkMediaPlayer == null) + return; + if (isSilence){ + ijkMediaPlayer.setVolume(0, 0); + btnSound.setBackgroundResource(R.drawable.ic_sound); + }else { + ijkMediaPlayer.setVolume(50, 50); + btnSound.setBackgroundResource(R.drawable.ic_silence); + } + break; + default: + break; + } + } + @Override protected void onStop() { super.onStop(); diff --git a/OnLive/src/main/res/drawable-xhdpi/ic_action_dark_aspect_ratio.png b/OnLive/src/main/res/drawable-xhdpi/ic_action_dark_aspect_ratio.png deleted file mode 100644 index e2c7044..0000000 Binary files a/OnLive/src/main/res/drawable-xhdpi/ic_action_dark_aspect_ratio.png and /dev/null differ diff --git a/OnLive/src/main/res/drawable-xhdpi/ic_action_dark_filter.png b/OnLive/src/main/res/drawable-xhdpi/ic_action_dark_filter.png deleted file mode 100644 index 64f91d6..0000000 Binary files a/OnLive/src/main/res/drawable-xhdpi/ic_action_dark_filter.png and /dev/null differ diff --git a/OnLive/src/main/res/drawable-xhdpi/ic_action_dark_settings.png b/OnLive/src/main/res/drawable-xhdpi/ic_action_dark_settings.png deleted file mode 100644 index 085e1d2..0000000 Binary files a/OnLive/src/main/res/drawable-xhdpi/ic_action_dark_settings.png and /dev/null differ diff --git a/OnLive/src/main/res/drawable-xhdpi/ic_pause.png b/OnLive/src/main/res/drawable-xhdpi/ic_pause.png new file mode 100644 index 0000000..dedce6a Binary files /dev/null and b/OnLive/src/main/res/drawable-xhdpi/ic_pause.png differ diff --git a/OnLive/src/main/res/drawable-xhdpi/ic_play.png b/OnLive/src/main/res/drawable-xhdpi/ic_play.png new file mode 100644 index 0000000..72dc5a4 Binary files /dev/null and b/OnLive/src/main/res/drawable-xhdpi/ic_play.png differ diff --git a/OnLive/src/main/res/drawable-xhdpi/ic_silence.png b/OnLive/src/main/res/drawable-xhdpi/ic_silence.png new file mode 100644 index 0000000..3ecb74f Binary files /dev/null and b/OnLive/src/main/res/drawable-xhdpi/ic_silence.png differ diff --git a/OnLive/src/main/res/drawable-xhdpi/ic_sound.png b/OnLive/src/main/res/drawable-xhdpi/ic_sound.png new file mode 100644 index 0000000..8a4742a Binary files /dev/null and b/OnLive/src/main/res/drawable-xhdpi/ic_sound.png differ diff --git a/OnLive/src/main/res/drawable-xhdpi/ic_theme_description.png b/OnLive/src/main/res/drawable-xhdpi/ic_theme_description.png deleted file mode 100644 index b378faf..0000000 Binary files a/OnLive/src/main/res/drawable-xhdpi/ic_theme_description.png and /dev/null differ diff --git a/OnLive/src/main/res/drawable-xhdpi/ic_theme_folder.png b/OnLive/src/main/res/drawable-xhdpi/ic_theme_folder.png deleted file mode 100644 index 57ab17e..0000000 Binary files a/OnLive/src/main/res/drawable-xhdpi/ic_theme_folder.png and /dev/null differ diff --git a/OnLive/src/main/res/drawable-xhdpi/ic_theme_play_arrow.png b/OnLive/src/main/res/drawable-xhdpi/ic_theme_play_arrow.png deleted file mode 100644 index 2414af6..0000000 Binary files a/OnLive/src/main/res/drawable-xhdpi/ic_theme_play_arrow.png and /dev/null differ diff --git a/OnLive/src/main/res/drawable-xxhdpi/ic_action_dark_aspect_ratio.png b/OnLive/src/main/res/drawable-xxhdpi/ic_action_dark_aspect_ratio.png deleted file mode 100644 index 1c3dce7..0000000 Binary files a/OnLive/src/main/res/drawable-xxhdpi/ic_action_dark_aspect_ratio.png and /dev/null differ diff --git a/OnLive/src/main/res/drawable-xxhdpi/ic_action_dark_filter.png b/OnLive/src/main/res/drawable-xxhdpi/ic_action_dark_filter.png deleted file mode 100644 index e0960c3..0000000 Binary files a/OnLive/src/main/res/drawable-xxhdpi/ic_action_dark_filter.png and /dev/null differ diff --git a/OnLive/src/main/res/drawable-xxhdpi/ic_action_dark_settings.png b/OnLive/src/main/res/drawable-xxhdpi/ic_action_dark_settings.png deleted file mode 100644 index 4f04891..0000000 Binary files a/OnLive/src/main/res/drawable-xxhdpi/ic_action_dark_settings.png and /dev/null differ diff --git a/OnLive/src/main/res/drawable-xxhdpi/ic_pause.png b/OnLive/src/main/res/drawable-xxhdpi/ic_pause.png new file mode 100644 index 0000000..dedce6a Binary files /dev/null and b/OnLive/src/main/res/drawable-xxhdpi/ic_pause.png differ diff --git a/OnLive/src/main/res/drawable-xxhdpi/ic_play.png b/OnLive/src/main/res/drawable-xxhdpi/ic_play.png new file mode 100644 index 0000000..72dc5a4 Binary files /dev/null and b/OnLive/src/main/res/drawable-xxhdpi/ic_play.png differ diff --git a/OnLive/src/main/res/drawable-xxhdpi/ic_silence.png b/OnLive/src/main/res/drawable-xxhdpi/ic_silence.png new file mode 100644 index 0000000..3ecb74f Binary files /dev/null and b/OnLive/src/main/res/drawable-xxhdpi/ic_silence.png differ diff --git a/OnLive/src/main/res/drawable-xxhdpi/ic_sound.png b/OnLive/src/main/res/drawable-xxhdpi/ic_sound.png new file mode 100644 index 0000000..8a4742a Binary files /dev/null and b/OnLive/src/main/res/drawable-xxhdpi/ic_sound.png differ diff --git a/OnLive/src/main/res/drawable-xxhdpi/ic_theme_description.png b/OnLive/src/main/res/drawable-xxhdpi/ic_theme_description.png deleted file mode 100644 index fdb98ad..0000000 Binary files a/OnLive/src/main/res/drawable-xxhdpi/ic_theme_description.png and /dev/null differ diff --git a/OnLive/src/main/res/drawable-xxhdpi/ic_theme_folder.png b/OnLive/src/main/res/drawable-xxhdpi/ic_theme_folder.png deleted file mode 100644 index 4e4e3f3..0000000 Binary files a/OnLive/src/main/res/drawable-xxhdpi/ic_theme_folder.png and /dev/null differ diff --git a/OnLive/src/main/res/drawable-xxhdpi/ic_theme_play_arrow.png b/OnLive/src/main/res/drawable-xxhdpi/ic_theme_play_arrow.png deleted file mode 100644 index ead95af..0000000 Binary files a/OnLive/src/main/res/drawable-xxhdpi/ic_theme_play_arrow.png and /dev/null differ diff --git a/OnLive/src/main/res/layout/activity_live.xml b/OnLive/src/main/res/layout/activity_live.xml index e327c48..c62b2b7 100644 --- a/OnLive/src/main/res/layout/activity_live.xml +++ b/OnLive/src/main/res/layout/activity_live.xml @@ -13,6 +13,25 @@ android:layout_gravity="center"> + + + + ![动态图片](https://github.com/xufuji456/FFmpegAndroid/blob/master/gif/reverse.gif) *** - -后续会完善音视频播放、推流直播。