diff --git a/README-ZH.md b/README-ZH.md
index 4763862e1..46abc022e 100644
--- a/README-ZH.md
+++ b/README-ZH.md
@@ -2,7 +2,7 @@
--
-
+
@@ -28,7 +28,7 @@
## 效果
-**[jiecaovideoplayer-5.5.4.apk](https://github.com/lipangit/JieCaoVideoPlayer/releases/download/v5.5.4/jiecaovideoplayer-5.5.4.apk)**
+**[jiecaovideoplayer-5.6.apk](https://github.com/lipangit/JieCaoVideoPlayer/releases/download/v5.6/jiecaovideoplayer-5.6.apk)**
![Demo Screenshot][1]
@@ -38,10 +38,10 @@
1.添加类库
```gradle
-compile 'fm.jiecao:jiecaovideoplayer:5.5.4'
+compile 'fm.jiecao:jiecaovideoplayer:5.6'
```
-[或直接下载jar包](https://github.com/lipangit/JieCaoVideoPlayer/releases/tag/v5.5.4)
+[或直接下载jar包](https://github.com/lipangit/JieCaoVideoPlayer/releases/tag/v5.6)
2.添加布局
```xml
diff --git a/README.md b/README.md
index a8c61da17..4732a5303 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
--
-
+
@@ -30,7 +30,7 @@ I think the final solution for play video in android is android.media.MediaPlaye
## Effect
-**[jiecaovideoplayer-5.5.4.apk](https://github.com/lipangit/JieCaoVideoPlayer/releases/download/v5.5.4/jiecaovideoplayer-5.5.4.apk)**
+**[jiecaovideoplayer-5.6.apk](https://github.com/lipangit/JieCaoVideoPlayer/releases/download/v5.6/jiecaovideoplayer-5.6.apk)**
![Demo Screenshot][1]
@@ -40,10 +40,10 @@ Even the custom UI, or has changed to the Library, is also the five steps to use
1.Import library
```gradle
-compile 'fm.jiecao:jiecaovideoplayer:5.5.4'
+compile 'fm.jiecao:jiecaovideoplayer:5.6'
```
-[Or download lib](https://github.com/lipangit/JieCaoVideoPlayer/releases/tag/v5.5.4)
+[Or download lib](https://github.com/lipangit/JieCaoVideoPlayer/releases/tag/v5.6)
2.Add JCVideoPlayer in your layout
```xml
diff --git a/app/build.gradle b/app/build.gradle
index 25d5aceea..285736e89 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -2,14 +2,14 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 25
- buildToolsVersion '25.0.3'
+ buildToolsVersion '26.0.0'
defaultConfig {
applicationId "fm.jiecao.jiecaovideoplayer"
minSdkVersion 16
targetSdkVersion 25
- versionCode 59
- versionName "5.5.4"
+ versionCode 60
+ versionName "5.6"
}
buildTypes {
release {
diff --git a/app/src/main/java/fm/jiecao/jiecaovideoplayer/ApiActivity.java b/app/src/main/java/fm/jiecao/jiecaovideoplayer/ApiActivity.java
index 4d98faeba..3f30ec6cb 100644
--- a/app/src/main/java/fm/jiecao/jiecaovideoplayer/ApiActivity.java
+++ b/app/src/main/java/fm/jiecao/jiecaovideoplayer/ApiActivity.java
@@ -70,7 +70,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
// cpAssertVideoToLocalPath();
// mJcVideoPlayerStandard.setUp(Environment.getExternalStorageDirectory().getAbsolutePath() + "/DCIM/Camera/local_video.mp4"
// , JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "嫂子不信");
- /** Play video in assert **/
+ /** Play video in assert, but not work now **/
// mJcVideoPlayerStandard.setUp("file:///android_asset/local_video.mp4"
// , JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "嫂子不信");
diff --git a/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardAutoCompleteAfterFullscreen.java b/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardAutoCompleteAfterFullscreen.java
index 561ff88f8..ea76495e3 100644
--- a/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardAutoCompleteAfterFullscreen.java
+++ b/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardAutoCompleteAfterFullscreen.java
@@ -21,7 +21,7 @@ public JCVideoPlayerStandardAutoCompleteAfterFullscreen(Context context, Attribu
@Override
public void onAutoCompletion() {
if (currentScreen == SCREEN_WINDOW_FULLSCREEN) {
- setUiWitStateAndScreen(CURRENT_STATE_AUTO_COMPLETE);
+ onStateAutoComplete();
} else {
super.onAutoCompletion();
}
diff --git a/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardFresco.java b/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardFresco.java
index 5873b3d7b..f4a567fb0 100755
--- a/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardFresco.java
+++ b/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardFresco.java
@@ -22,9 +22,11 @@
import java.util.Timer;
import java.util.TimerTask;
+import fm.jiecao.jcvideoplayer_lib.JCUserAction;
import fm.jiecao.jcvideoplayer_lib.JCUserActionStandard;
import fm.jiecao.jcvideoplayer_lib.JCUtils;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer;
+import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard;
import fm.jiecao.jiecaovideoplayer.R;
//import com.facebook.drawee.view.SimpleDraweeView;
@@ -34,18 +36,8 @@
* Created by Nathen
* On 2016/05/01 22:59
*/
-public class JCVideoPlayerStandardFresco extends JCVideoPlayer {
-
- public ImageView backButton;
- public ProgressBar bottomProgressBar, loadingProgressBar;
- public TextView titleTextView;
+public class JCVideoPlayerStandardFresco extends JCVideoPlayerStandard {
// public SimpleDraweeView thumbImageView;
- public ImageView tinyBackImageView;
-
- protected static Timer DISSMISS_CONTROL_VIEW_TIMER;
- protected DismissControlViewTimerTask mDismissControlViewTimerTask;
-
- protected static JCUserActionStandard JC_USER_EVENT_STANDARD;
public JCVideoPlayerStandardFresco(Context context) {
super(context);
@@ -96,541 +88,5 @@ public int getLayoutId() {
return R.layout.layout_standard_fresco;
}
- @Override
- public void setUiWitStateAndScreen(int state) {
- super.setUiWitStateAndScreen(state);
- switch (currentState) {
- case CURRENT_STATE_NORMAL:
- changeUiToNormal();
- break;
- case CURRENT_STATE_PREPARING:
- changeUiToPreparingShow();
- startDismissControlViewTimer();
- break;
- case CURRENT_STATE_PLAYING:
- changeUiToPlayingShow();
- startDismissControlViewTimer();
- break;
- case CURRENT_STATE_PAUSE:
- changeUiToPauseShow();
- cancelDismissControlViewTimer();
- break;
- case CURRENT_STATE_ERROR:
- changeUiToError();
- break;
- case CURRENT_STATE_AUTO_COMPLETE:
- changeUiToCompleteShow();
- cancelDismissControlViewTimer();
- bottomProgressBar.setProgress(100);
- break;
- case CURRENT_STATE_PLAYING_BUFFERING_START:
- changeUiToPlayingBufferingShow();
- break;
- }
- }
-
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- int id = v.getId();
- if (id == R.id.surface_container) {
- switch (event.getAction()) {
- case MotionEvent.ACTION_DOWN:
- break;
- case MotionEvent.ACTION_MOVE:
- break;
- case MotionEvent.ACTION_UP:
- startDismissControlViewTimer();
- if (mChangePosition) {
- int duration = getDuration();
- int progress = mSeekTimePosition * 100 / (duration == 0 ? 1 : duration);
- bottomProgressBar.setProgress(progress);
- }
- if (!mChangePosition && !mChangeVolume) {
- onClickUiToggle();
- }
- break;
- }
- } else if (id == R.id.bottom_seek_progress) {
- switch (event.getAction()) {
- case MotionEvent.ACTION_DOWN:
- cancelDismissControlViewTimer();
- break;
- case MotionEvent.ACTION_UP:
- startDismissControlViewTimer();
- break;
- }
- }
- return super.onTouch(v, event);
- }
-
- @Override
- public void onClick(View v) {
- super.onClick(v);
- int i = v.getId();
- if (i == R.id.thumb) {
- if (TextUtils.isEmpty(url)) {
- Toast.makeText(getContext(), getResources().getString(R.string.no_url), Toast.LENGTH_SHORT).show();
- return;
- }
- if (currentState == CURRENT_STATE_NORMAL) {
- if (!url.startsWith("file") && !JCUtils.isWifiConnected(getContext()) && !WIFI_TIP_DIALOG_SHOWED) {
- showWifiDialog();
- return;
- }
- startPlayLogic();
- } else if (currentState == CURRENT_STATE_AUTO_COMPLETE) {
- onClickUiToggle();
- }
- } else if (i == R.id.surface_container) {
- if (JC_USER_EVENT_STANDARD != null && isCurrentJcvd()) {
-// if (mIfCurrentIsFullscreen) {
-// JC_USER_EVENT_STANDARD.onClickBlankFullscreen(url, objects);
-// } else {
-// JC_USER_EVENT_STANDARD.onClickBlank(url, objects);
-// }
- }
- startDismissControlViewTimer();
- } else if (i == R.id.back) {
- backPress();
- } else if (i == R.id.back_tiny) {
- backPress();
- }
- }
-
- @Override
- public void showWifiDialog() {
- super.showWifiDialog();
- AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
- builder.setMessage(getResources().getString(R.string.tips_not_wifi));
- builder.setPositiveButton(getResources().getString(R.string.tips_not_wifi_confirm), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- startPlayLogic();
- WIFI_TIP_DIALOG_SHOWED = true;
- }
- });
- builder.setNegativeButton(getResources().getString(R.string.tips_not_wifi_cancel), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- }
- });
- builder.create().show();
- }
-
- @Override
- public void onStartTrackingTouch(SeekBar seekBar) {
- super.onStartTrackingTouch(seekBar);
- cancelDismissControlViewTimer();
- }
-
- @Override
- public void onStopTrackingTouch(SeekBar seekBar) {
- super.onStopTrackingTouch(seekBar);
- startDismissControlViewTimer();
- }
-
- private void startPlayLogic() {
- onEvent(JCUserActionStandard.ON_CLICK_START_THUMB);
- prepareMediaPlayer();
- startDismissControlViewTimer();
- }
-
- private void onClickUiToggle() {
- if (currentState == CURRENT_STATE_PREPARING) {
- if (bottomContainer.getVisibility() == View.VISIBLE) {
- changeUiToPreparingClear();
- } else {
- changeUiToPreparingShow();
- }
- } else if (currentState == CURRENT_STATE_PLAYING) {
- if (bottomContainer.getVisibility() == View.VISIBLE) {
- changeUiToPlayingClear();
- } else {
- changeUiToPlayingShow();
- }
- } else if (currentState == CURRENT_STATE_PAUSE) {
- if (bottomContainer.getVisibility() == View.VISIBLE) {
- changeUiToPauseClear();
- } else {
- changeUiToPauseShow();
- }
- } else if (currentState == CURRENT_STATE_AUTO_COMPLETE) {
- if (bottomContainer.getVisibility() == View.VISIBLE) {
- changeUiToCompleteClear();
- } else {
- changeUiToCompleteShow();
- }
- } else if (currentState == CURRENT_STATE_PLAYING_BUFFERING_START) {
- if (bottomContainer.getVisibility() == View.VISIBLE) {
- changeUiToPlayingBufferingClear();
- } else {
- changeUiToPlayingBufferingShow();
- }
- }
- }
-
-// @Override
-// public void setProgressAndTime(int progress, int secProgress, int currentTime, int totalTime) {
-// super.setProgressAndTime(progress, secProgress, currentTime, totalTime);
-// if (progress != 0) bottomProgressBar.setProgress(progress);
-// if (secProgress != 0) bottomProgressBar.setSecondaryProgress(secProgress);
-// }
-
- @Override
- public void resetProgressAndTime() {
- super.resetProgressAndTime();
- bottomProgressBar.setProgress(0);
- bottomProgressBar.setSecondaryProgress(0);
- }
-
- //Unified management Ui
- public void changeUiToNormal() {
- switch (currentScreen) {
- case SCREEN_LAYOUT_LIST:
- setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.VISIBLE,
- View.INVISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_FULLSCREEN:
- setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.VISIBLE,
- View.INVISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_TINY:
- break;
- }
- }
-
- public void changeUiToPreparingShow() {
- switch (currentScreen) {
- case SCREEN_LAYOUT_LIST:
- setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.INVISIBLE,
- View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE);
- break;
- case SCREEN_WINDOW_FULLSCREEN:
- setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.INVISIBLE,
- View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE);
- break;
- case SCREEN_WINDOW_TINY:
- break;
- }
-
- }
-
- private void changeUiToPreparingClear() {
- switch (currentScreen) {
- case SCREEN_LAYOUT_LIST:
- setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE,
- View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE);
- break;
- case SCREEN_WINDOW_FULLSCREEN:
- setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE,
- View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE);
- break;
- case SCREEN_WINDOW_TINY:
- break;
- }
-
- }
-
- private void changeUiToPlayingShow() {
- switch (currentScreen) {
- case SCREEN_LAYOUT_LIST:
- setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE,
- View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_FULLSCREEN:
- setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE,
- View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_TINY:
- break;
- }
-
- }
-
- private void changeUiToPlayingClear() {
- switch (currentScreen) {
- case SCREEN_LAYOUT_LIST:
- setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE,
- View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
- break;
- case SCREEN_WINDOW_FULLSCREEN:
- setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE,
- View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
- break;
- case SCREEN_WINDOW_TINY:
- break;
- }
-
- }
-
- private void changeUiToPauseShow() {
- switch (currentScreen) {
- case SCREEN_LAYOUT_LIST:
- setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE,
- View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_FULLSCREEN:
- setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE,
- View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_TINY:
- break;
- }
-
- }
-
- private void changeUiToPauseClear() {
- switch (currentScreen) {
- case SCREEN_LAYOUT_LIST:
- setAllControlsVisible(View.INVISIBLE, View.VISIBLE, View.INVISIBLE,
- View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
- break;
- case SCREEN_WINDOW_FULLSCREEN:
- setAllControlsVisible(View.INVISIBLE, View.VISIBLE, View.INVISIBLE,
- View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
- break;
- case SCREEN_WINDOW_TINY:
- break;
- }
-
- }
-
- private void changeUiToPlayingBufferingShow() {
- switch (currentScreen) {
- case SCREEN_LAYOUT_LIST:
- setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.INVISIBLE,
- View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
- break;
- case SCREEN_WINDOW_FULLSCREEN:
- setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.INVISIBLE,
- View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE);
- break;
- case SCREEN_WINDOW_TINY:
- break;
- }
-
- }
-
- private void changeUiToPlayingBufferingClear() {
- switch (currentScreen) {
- case SCREEN_LAYOUT_LIST:
- setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE,
- View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_FULLSCREEN:
- setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE,
- View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_TINY:
- break;
- }
-
- }
-
- private void changeUiToCompleteShow() {
- switch (currentScreen) {
- case SCREEN_LAYOUT_LIST:
- setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE,
- View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_FULLSCREEN:
- setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE,
- View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_TINY:
- break;
- }
-
- }
-
- private void changeUiToCompleteClear() {
- switch (currentScreen) {
- case SCREEN_LAYOUT_LIST:
- setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE,
- View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_FULLSCREEN:
- setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE,
- View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_TINY:
- break;
- }
-
- }
-
- private void changeUiToError() {
- switch (currentScreen) {
- case SCREEN_LAYOUT_LIST:
- setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE,
- View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_FULLSCREEN:
- setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE,
- View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE);
- updateStartImage();
- break;
- case SCREEN_WINDOW_TINY:
- break;
- }
-
- }
-
- private void setAllControlsVisible(int topCon, int bottomCon, int startBtn, int loadingPro,
- int thumbImg, int coverImg, int bottomPro) {
- topContainer.setVisibility(topCon);
- bottomContainer.setVisibility(bottomCon);
- startButton.setVisibility(startBtn);
- loadingProgressBar.setVisibility(loadingPro);
-// thumbImageView.setVisibility(thumbImg);
- bottomProgressBar.setVisibility(bottomPro);
- }
-
- private void updateStartImage() {
- if (currentState == CURRENT_STATE_PLAYING) {
- startButton.setImageResource(R.drawable.jc_click_pause_selector);
- } else if (currentState == CURRENT_STATE_ERROR) {
- startButton.setImageResource(R.drawable.jc_click_error_selector);
- } else {
- startButton.setImageResource(R.drawable.jc_click_play_selector);
- }
- }
-
- protected Dialog mProgressDialog;
- protected ProgressBar mDialogProgressBar;
- protected TextView mDialogSeekTime;
- protected TextView mDialogTotalTime;
- protected ImageView mDialogIcon;
-
- @Override
- public void showProgressDialog(float deltaX, String seekTime, int seekTimePosition, String totalTime, int totalTimeDuration) {
- super.showProgressDialog(deltaX, seekTime, seekTimePosition, totalTime, totalTimeDuration);
- if (mProgressDialog == null) {
- View localView = LayoutInflater.from(getContext()).inflate(R.layout.jc_dialog_progress, null);
- mDialogProgressBar = ((ProgressBar) localView.findViewById(R.id.duration_progressbar));
- mDialogSeekTime = ((TextView) localView.findViewById(R.id.tv_current));
- mDialogTotalTime = ((TextView) localView.findViewById(R.id.tv_duration));
- mDialogIcon = ((ImageView) localView.findViewById(R.id.duration_image_tip));
- mProgressDialog = new Dialog(getContext(), R.style.jc_style_dialog_progress);
- mProgressDialog.setContentView(localView);
- mProgressDialog.getWindow().addFlags(Window.FEATURE_ACTION_BAR);
- mProgressDialog.getWindow().addFlags(32);
- mProgressDialog.getWindow().addFlags(16);
- mProgressDialog.getWindow().setLayout(-2, -2);
- WindowManager.LayoutParams localLayoutParams = mProgressDialog.getWindow().getAttributes();
- localLayoutParams.gravity = Gravity.CENTER;
- mProgressDialog.getWindow().setAttributes(localLayoutParams);
- }
- if (!mProgressDialog.isShowing()) {
- mProgressDialog.show();
- }
-
- mDialogSeekTime.setText(seekTime);
- mDialogTotalTime.setText(" / " + totalTime);
- mDialogProgressBar.setProgress(seekTimePosition * 100 / totalTimeDuration);
- if (deltaX > 0) {
- mDialogIcon.setBackgroundResource(R.drawable.jc_forward_icon);
- } else {
- mDialogIcon.setBackgroundResource(R.drawable.jc_backward_icon);
- }
-
- }
-
- @Override
- public void dismissProgressDialog() {
- super.dismissProgressDialog();
- if (mProgressDialog != null) {
- mProgressDialog.dismiss();
- }
- }
-
-
- protected Dialog mVolumeDialog;
- protected ProgressBar mDialogVolumeProgressBar;
-
- @Override
- public void showVolumeDialog(float deltaY, int volumePercent) {
- super.showVolumeDialog(deltaY, volumePercent);
- if (mVolumeDialog == null) {
- View localView = LayoutInflater.from(getContext()).inflate(R.layout.jc_dialog_volume, null);
- mDialogVolumeProgressBar = ((ProgressBar) localView.findViewById(R.id.volume_progressbar));
- mVolumeDialog = new Dialog(getContext(), R.style.jc_style_dialog_progress);
- mVolumeDialog.setContentView(localView);
- mVolumeDialog.getWindow().addFlags(8);
- mVolumeDialog.getWindow().addFlags(32);
- mVolumeDialog.getWindow().addFlags(16);
- mVolumeDialog.getWindow().setLayout(-2, -2);
- WindowManager.LayoutParams localLayoutParams = mVolumeDialog.getWindow().getAttributes();
- localLayoutParams.gravity = Gravity.CENTER;
- mVolumeDialog.getWindow().setAttributes(localLayoutParams);
- }
- if (!mVolumeDialog.isShowing()) {
- mVolumeDialog.show();
- }
-
- mDialogVolumeProgressBar.setProgress(volumePercent);
- }
-
- @Override
- public void dismissVolumeDialog() {
- super.dismissVolumeDialog();
- if (mVolumeDialog != null) {
- mVolumeDialog.dismiss();
- }
- }
-
- private void startDismissControlViewTimer() {
- cancelDismissControlViewTimer();
- DISSMISS_CONTROL_VIEW_TIMER = new Timer();
- mDismissControlViewTimerTask = new DismissControlViewTimerTask();
- DISSMISS_CONTROL_VIEW_TIMER.schedule(mDismissControlViewTimerTask, 2500);
- }
-
- private void cancelDismissControlViewTimer() {
- if (DISSMISS_CONTROL_VIEW_TIMER != null) {
- DISSMISS_CONTROL_VIEW_TIMER.cancel();
- }
- if (mDismissControlViewTimerTask != null) {
- mDismissControlViewTimerTask.cancel();
- }
-
- }
-
- protected class DismissControlViewTimerTask extends TimerTask {
-
- @Override
- public void run() {
- if (currentState != CURRENT_STATE_NORMAL
- && currentState != CURRENT_STATE_ERROR
- && currentState != CURRENT_STATE_AUTO_COMPLETE) {
- if (getContext() != null && getContext() instanceof Activity) {
- ((Activity) getContext()).runOnUiThread(new Runnable() {
- @Override
- public void run() {
- bottomContainer.setVisibility(View.INVISIBLE);
- topContainer.setVisibility(View.INVISIBLE);
- bottomProgressBar.setVisibility(View.VISIBLE);
- startButton.setVisibility(View.INVISIBLE);
- }
- });
- }
- }
- }
- }
}
diff --git a/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardShowState.java b/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardShowState.java
new file mode 100644
index 000000000..df20cd929
--- /dev/null
+++ b/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardShowState.java
@@ -0,0 +1,110 @@
+package fm.jiecao.jiecaovideoplayer.CustomView;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+
+import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard;
+
+/**
+ * Created by Nathen on 2017/7/2.
+ */
+public class JCVideoPlayerStandardShowState extends JCVideoPlayerStandard {
+ public JCVideoPlayerStandardShowState(Context context) {
+ super(context);
+ }
+
+ public JCVideoPlayerStandardShowState(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public void init(Context context) {
+ super.init(context);
+ }
+
+ @Override
+ public void onClick(View v) {
+ super.onClick(v);
+ int i = v.getId();
+ if (i == fm.jiecao.jcvideoplayer_lib.R.id.fullscreen) {
+ if (currentScreen == SCREEN_WINDOW_FULLSCREEN) {
+ //click quit fullscreen
+ } else {
+ //click goto fullscreen
+ }
+ }
+ }
+
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ return super.onTouch(v, event);
+ }
+
+ @Override
+ public void startVideo() {
+ super.startVideo();
+ }
+
+ @Override
+ public void onPrepared() {
+ super.onPrepared();
+ }
+
+ @Override
+ public void onStateNormal() {
+ super.onStateNormal();
+ }
+
+ @Override
+ public void onStatePreparing() {
+ super.onStatePreparing();
+ }
+
+ @Override
+ public void onStatePlaying() {
+ super.onStatePlaying();
+ }
+
+ @Override
+ public void onStatePause() {
+ super.onStatePause();
+ }
+
+ @Override
+ public void onStatePlaybackBufferingStart() {
+ super.onStatePlaybackBufferingStart();
+ }
+
+ @Override
+ public void onStateError() {
+ super.onStateError();
+ }
+
+ @Override
+ public void onStateAutoComplete() {
+ super.onStateAutoComplete();
+ }
+
+ @Override
+ public void onInfo(int what, int extra) {
+ super.onInfo(what, extra);
+ }
+
+ @Override
+ public void onError(int what, int extra) {
+ super.onError(what, extra);
+ }
+
+ @Override
+ public void startWindowFullscreen() {
+ super.startWindowFullscreen();
+ }
+
+ @Override
+ public void startWindowTiny() {
+ super.startWindowTiny();
+ }
+
+}
diff --git a/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardShowTextureViewAfterAutoComplete.java b/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardShowTextureViewAfterAutoComplete.java
index 959dc348b..3deca692e 100644
--- a/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardShowTextureViewAfterAutoComplete.java
+++ b/app/src/main/java/fm/jiecao/jiecaovideoplayer/CustomView/JCVideoPlayerStandardShowTextureViewAfterAutoComplete.java
@@ -20,11 +20,9 @@ public JCVideoPlayerStandardShowTextureViewAfterAutoComplete(Context context, At
}
@Override
- public void setUiWitStateAndScreen(int state) {
- super.setUiWitStateAndScreen(state);
- if (state == CURRENT_STATE_AUTO_COMPLETE) {
- thumbImageView.setVisibility(View.GONE);
- }
+ public void onAutoCompletion() {
+ super.onAutoCompletion();
+ thumbImageView.setVisibility(View.GONE);
}
@Override
diff --git a/app/src/main/java/fm/jiecao/jiecaovideoplayer/DemoFragment.java b/app/src/main/java/fm/jiecao/jiecaovideoplayer/DemoFragment.java
new file mode 100644
index 000000000..852cb359d
--- /dev/null
+++ b/app/src/main/java/fm/jiecao/jiecaovideoplayer/DemoFragment.java
@@ -0,0 +1,36 @@
+package fm.jiecao.jiecaovideoplayer;
+
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ListView;
+
+/**
+ * Created by Nathen on 2017/6/9.
+ */
+public class DemoFragment extends Fragment {
+
+ ListView listView;
+ int index;
+
+ public DemoFragment setIndex(int index) {
+ this.index = index;
+ return this;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInastanceState) {
+ listView = (ListView) inflater.inflate(R.layout.layout_list, container, false);
+ listView.setAdapter(new VideoListAdapter(getActivity(), index));
+ return listView;
+ }
+}
diff --git a/app/src/main/java/fm/jiecao/jiecaovideoplayer/ListViewViewpagerActivity.java b/app/src/main/java/fm/jiecao/jiecaovideoplayer/ListViewViewpagerActivity.java
index ad8ab5735..c2d2da3b7 100755
--- a/app/src/main/java/fm/jiecao/jiecaovideoplayer/ListViewViewpagerActivity.java
+++ b/app/src/main/java/fm/jiecao/jiecaovideoplayer/ListViewViewpagerActivity.java
@@ -1,6 +1,9 @@
package fm.jiecao.jiecaovideoplayer;
import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
@@ -18,6 +21,8 @@
* On 2016/02/07 01:01
*/
public class ListViewViewpagerActivity extends AppCompatActivity implements ViewPager.OnPageChangeListener {
+ List fragmentList = new ArrayList<>();
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -28,20 +33,11 @@ protected void onCreate(Bundle savedInstanceState) {
getSupportActionBar().setDisplayUseLogoEnabled(false);
getSupportActionBar().setTitle("ViewPagerAndListView");
- List listViews = new ArrayList<>();
- ListView listView1 = (ListView) getLayoutInflater().inflate(R.layout.layout_list, null);
- ListView listView2 = (ListView) getLayoutInflater().inflate(R.layout.layout_list, null);
- ListView listView3 = (ListView) getLayoutInflater().inflate(R.layout.layout_list, null);
-
- listView1.setAdapter(new VideoListAdapter(this, 0));
- listView2.setAdapter(new VideoListAdapter(this, 1));
- listView3.setAdapter(new VideoListAdapter(this, 2));
-
- listViews.add(listView1);
- listViews.add(listView2);
- listViews.add(listView3);
+ fragmentList.add(new DemoFragment().setIndex(0));
+ fragmentList.add(new DemoFragment().setIndex(1));
+ fragmentList.add(new DemoFragment().setIndex(2));
- MyAdapter myAdapter = new MyAdapter(listViews);
+ MyAdapter myAdapter = new MyAdapter(getSupportFragmentManager());
ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setAdapter(myAdapter);
viewPager.setOnPageChangeListener(this);
@@ -68,36 +64,22 @@ public void onPageScrollStateChanged(int state) {
}
- public class MyAdapter extends PagerAdapter {
+ public class MyAdapter extends FragmentPagerAdapter {
- List viewLists;
-
- public MyAdapter(List lists) {
- viewLists = lists;
+ public MyAdapter(FragmentManager fm) {
+ super(fm);
}
@Override
- public int getCount() {
- // TODO Auto-generated method stub
- return viewLists.size();
+ public Fragment getItem(int i) {
+ return fragmentList.get(i);
}
@Override
- public boolean isViewFromObject(View arg0, Object arg1) {
- // TODO Auto-generated method stub
- return arg0 == arg1;
- }
-
- @Override
- public void destroyItem(View view, int position, Object object) {
- ((ViewPager) view).removeView(viewLists.get(position));
+ public int getCount() {
+ return fragmentList.size();
}
- @Override
- public Object instantiateItem(View view, int position) {
- ((ViewPager) view).addView(viewLists.get(position), 0);
- return viewLists.get(position);
- }
}
@Override
diff --git a/app/src/main/res/drawable/skin_seek_progress.xml b/app/src/main/res/drawable/skin_seek_progress.xml
index ab9ba80e1..75d77cb71 100644
--- a/app/src/main/res/drawable/skin_seek_progress.xml
+++ b/app/src/main/res/drawable/skin_seek_progress.xml
@@ -3,7 +3,7 @@
-
-
+
@@ -11,7 +11,7 @@
-
+
@@ -20,7 +20,7 @@
-
+
diff --git a/app/src/main/res/layout/activity_api.xml b/app/src/main/res/layout/activity_api.xml
index ffcc2c45e..c3a352285 100644
--- a/app/src/main/res/layout/activity_api.xml
+++ b/app/src/main/res/layout/activity_api.xml
@@ -29,7 +29,7 @@
diff --git a/gradle/maven_push.gradle b/gradle/maven_push.gradle
index 3ff6643b8..9c3cd6728 100644
--- a/gradle/maven_push.gradle
+++ b/gradle/maven_push.gradle
@@ -22,7 +22,7 @@ signing {
group = "fm.jiecao"
archivesBaseName = "jiecaovideoplayer"
-version = "5.5.4"
+version = "5.6"
uploadArchives {
repositories {
diff --git a/jcvideoplayer-lib/build.gradle b/jcvideoplayer-lib/build.gradle
index da8610b71..9f59a94be 100644
--- a/jcvideoplayer-lib/build.gradle
+++ b/jcvideoplayer-lib/build.gradle
@@ -2,13 +2,13 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 25
- buildToolsVersion '25.0.3'
+ buildToolsVersion '26.0.0'
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
- versionCode 59
- versionName "5.5.4"
+ versionCode 60
+ versionName "5.6"
}
buildTypes {
release {
diff --git a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCUtils.java b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCUtils.java
index f66986e51..e0a03bffe 100644
--- a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCUtils.java
+++ b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCUtils.java
@@ -39,7 +39,7 @@ public static String stringForTime(int timeMs) {
/**
* This method requires the caller to hold the permission ACCESS_NETWORK_STATE.
*
- * @param context a application context
+ * @param context context
* @return if wifi is connected,return true
*/
public static boolean isWifiConnected(Context context) {
@@ -51,7 +51,7 @@ public static boolean isWifiConnected(Context context) {
/**
* Get activity from context object
*
- * @param context something
+ * @param context context
* @return object of Activity or null if it is not Activity
*/
public static Activity scanForActivity(Context context) {
@@ -69,7 +69,7 @@ public static Activity scanForActivity(Context context) {
/**
* Get AppCompatActivity from context
*
- * @param context
+ * @param context context
* @return AppCompatActivity if it's not null
*/
public static AppCompatActivity getAppCompActivity(Context context) {
@@ -107,7 +107,7 @@ public static int getSavedProgress(Context context, String url) {
/**
* if url == null, clear all progress
*
- * @param context
+ * @param context context
* @param url if url!=null clear this url progress
*/
public static void clearSavedProgress(Context context, String url) {
diff --git a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayer.java b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayer.java
index c34d0338c..1319ca109 100644
--- a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayer.java
+++ b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayer.java
@@ -114,6 +114,8 @@ public JCVideoPlayer(Context context, AttributeSet attrs) {
init(context);
}
+ public abstract int getLayoutId();
+
public void init(Context context) {
View.inflate(context, getLayoutId(), this);
startButton = (ImageView) findViewById(R.id.start);
@@ -136,6 +138,8 @@ public void init(Context context) {
mScreenHeight = getContext().getResources().getDisplayMetrics().heightPixels;
mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
mHandler = new Handler();
+
+ NORMAL_ORIENTATION = context.getResources().getConfiguration().orientation;
}
public void setUp(String url, int screen, Object... objects) {
@@ -146,7 +150,7 @@ public void setUp(String url, int screen, Object... objects) {
this.objects = objects;
this.currentScreen = screen;
this.headData = null;
- setUiWitStateAndScreen(CURRENT_STATE_NORMAL);
+ onStateNormal();
}
@Override
@@ -160,23 +164,23 @@ public void onClick(View v) {
}
if (currentState == CURRENT_STATE_NORMAL || currentState == CURRENT_STATE_ERROR) {
if (!url.startsWith("file") && !JCUtils.isWifiConnected(getContext()) && !WIFI_TIP_DIALOG_SHOWED) {
- showWifiDialog();
+ showWifiDialog(JCUserActionStandard.ON_CLICK_START_ICON);
return;
}
- prepareMediaPlayer();
+ startVideo();
onEvent(currentState != CURRENT_STATE_ERROR ? JCUserAction.ON_CLICK_START_ICON : JCUserAction.ON_CLICK_START_ERROR);
} else if (currentState == CURRENT_STATE_PLAYING) {
onEvent(JCUserAction.ON_CLICK_PAUSE);
Log.d(TAG, "pauseVideo [" + this.hashCode() + "] ");
JCMediaManager.instance().mediaPlayer.pause();
- setUiWitStateAndScreen(CURRENT_STATE_PAUSE);
+ onStatePause();
} else if (currentState == CURRENT_STATE_PAUSE) {
onEvent(JCUserAction.ON_CLICK_RESUME);
JCMediaManager.instance().mediaPlayer.start();
- setUiWitStateAndScreen(CURRENT_STATE_PLAYING);
+ onStatePlaying();
} else if (currentState == CURRENT_STATE_AUTO_COMPLETE) {
onEvent(JCUserAction.ON_CLICK_START_AUTO_COMPLETE);
- prepareMediaPlayer();
+ startVideo();
}
} else if (i == R.id.fullscreen) {
Log.i(TAG, "onClick fullscreen [" + this.hashCode() + "] ");
@@ -191,25 +195,10 @@ public void onClick(View v) {
}
} else if (i == R.id.surface_container && currentState == CURRENT_STATE_ERROR) {
Log.i(TAG, "onClick surfaceContainer State=Error [" + this.hashCode() + "] ");
- prepareMediaPlayer();
+ startVideo();
}
}
- public void prepareMediaPlayer() {
- JCVideoPlayerManager.completeAll();
- Log.d(TAG, "prepareMediaPlayer [" + this.hashCode() + "] ");
- initTextureView();
- addTextureView();
- AudioManager mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
- mAudioManager.requestAudioFocus(onAudioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
- JCUtils.scanForActivity(getContext()).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- JCMediaManager.CURRENT_PLAYING_URL = url;
- JCMediaManager.CURRENT_PLING_LOOP = loop;
- JCMediaManager.MAP_HEADER_DATA = headData;
- setUiWitStateAndScreen(CURRENT_STATE_PREPARING);
- JCVideoPlayerManager.setFirstFloor(this);
- }
-
@Override
public boolean onTouch(View v, MotionEvent event) {
float x = event.getX();
@@ -329,125 +318,161 @@ public boolean onTouch(View v, MotionEvent event) {
return false;
}
- public int widthRatio = 0;
- public int heightRatio = 0;
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- if (currentScreen == SCREEN_WINDOW_FULLSCREEN || currentScreen == SCREEN_WINDOW_TINY) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- return;
- }
- if (widthRatio != 0 && heightRatio != 0) {
- int specWidth = MeasureSpec.getSize(widthMeasureSpec);
- int specHeight = (int) ((specWidth * (float) heightRatio) / widthRatio);
- setMeasuredDimension(specWidth, specHeight);
-
- int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(specWidth, MeasureSpec.EXACTLY);
- int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(specHeight, MeasureSpec.EXACTLY);
- getChildAt(0).measure(childWidthMeasureSpec, childHeightMeasureSpec);
- } else {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- }
-
- }
-
- public void initTextureView() {
- removeTextureView();
- JCMediaManager.textureView = new JCResizeTextureView(getContext());
- JCMediaManager.textureView.setSurfaceTextureListener(JCMediaManager.instance());
+ public void startVideo() {
+ JCVideoPlayerManager.completeAll();
+ Log.d(TAG, "startVideo [" + this.hashCode() + "] ");
+ initTextureView();
+ addTextureView();
+ AudioManager mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
+ mAudioManager.requestAudioFocus(onAudioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
+ JCUtils.scanForActivity(getContext()).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ JCMediaManager.CURRENT_PLAYING_URL = url;
+ JCMediaManager.CURRENT_PLING_LOOP = loop;
+ JCMediaManager.MAP_HEADER_DATA = headData;
+ onStatePreparing();
+ JCVideoPlayerManager.setFirstFloor(this);
}
- public void addTextureView() {
- Log.d(TAG, "addTextureView [" + this.hashCode() + "] ");
- FrameLayout.LayoutParams layoutParams =
- new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT,
- Gravity.CENTER);
- textureViewContainer.addView(JCMediaManager.textureView, layoutParams);
- }
+ public void onPrepared() {
+ Log.i(TAG, "onPrepared " + " [" + this.hashCode() + "] ");
- public void removeTextureView() {
- JCMediaManager.savedSurfaceTexture = null;
- if (JCMediaManager.textureView != null && JCMediaManager.textureView.getParent() != null) {
- ((ViewGroup) JCMediaManager.textureView.getParent()).removeView(JCMediaManager.textureView);
+ if (currentState != CURRENT_STATE_PREPARING && currentState != CURRENT_STATE_PLAYING_BUFFERING_START)
+ return;
+ if (seekToInAdvance != 0) {
+ JCMediaManager.instance().mediaPlayer.seekTo(seekToInAdvance);
+ seekToInAdvance = 0;
+ } else {
+ int position = JCUtils.getSavedProgress(getContext(), url);
+ if (position != 0) {
+ JCMediaManager.instance().mediaPlayer.seekTo(position);
+ }
}
+ startProgressTimer();
+ onStatePlaying();
}
- public void setUiWitStateAndScreen(int state) {
- currentState = state;
- switch (currentState) {
+ public void setState(int state) {
+ switch (state) {
case CURRENT_STATE_NORMAL:
- cancelProgressTimer();
- if (isCurrentJcvd()) {//这个if是无法取代的,否则进入全屏的时候会releaseMediaPlayer
- JCMediaManager.instance().releaseMediaPlayer();
- }
+ onStateNormal();
break;
case CURRENT_STATE_PREPARING:
- resetProgressAndTime();
+ onStatePreparing();
break;
case CURRENT_STATE_PLAYING:
+ onStatePlaying();
+ break;
case CURRENT_STATE_PAUSE:
+ onStatePause();
+ break;
case CURRENT_STATE_PLAYING_BUFFERING_START:
- startProgressTimer();
+ onStatePlaybackBufferingStart();
break;
case CURRENT_STATE_ERROR:
- cancelProgressTimer();
+ onStateError();
break;
case CURRENT_STATE_AUTO_COMPLETE:
- cancelProgressTimer();
- progressBar.setProgress(100);
- currentTimeTextView.setText(totalTimeTextView.getText());
+ onStateAutoComplete();
break;
}
}
- public void startProgressTimer() {
+ public void onStateNormal() {
+ Log.i(TAG, "onStateNormal " + " [" + this.hashCode() + "] ");
+ currentState = CURRENT_STATE_NORMAL;
cancelProgressTimer();
- UPDATE_PROGRESS_TIMER = new Timer();
- mProgressTimerTask = new ProgressTimerTask();
- UPDATE_PROGRESS_TIMER.schedule(mProgressTimerTask, 0, 300);
+ if (isCurrentJcvd()) {//这个if是无法取代的,否则进入全屏的时候会releaseMediaPlayer
+ JCMediaManager.instance().releaseMediaPlayer();
+ }
}
- public void cancelProgressTimer() {
- if (UPDATE_PROGRESS_TIMER != null) {
- UPDATE_PROGRESS_TIMER.cancel();
- }
- if (mProgressTimerTask != null) {
- mProgressTimerTask.cancel();
- }
+ public void onStatePreparing() {
+ Log.i(TAG, "onStatePreparing " + " [" + this.hashCode() + "] ");
+ currentState = CURRENT_STATE_PREPARING;
+ resetProgressAndTime();
}
- public void onPrepared() {
- Log.i(TAG, "onPrepared " + " [" + this.hashCode() + "] ");
+ public void onStatePlaying() {
+ Log.i(TAG, "onStatePlaying " + " [" + this.hashCode() + "] ");
+ currentState = CURRENT_STATE_PLAYING;
+ startProgressTimer();
+ }
- if (currentState != CURRENT_STATE_PREPARING) return;
- if (seekToInAdvance != 0) {
- JCMediaManager.instance().mediaPlayer.seekTo(seekToInAdvance);
- seekToInAdvance = 0;
- } else {
- int position = JCUtils.getSavedProgress(getContext(), url);
- if (position != 0) {
- JCMediaManager.instance().mediaPlayer.seekTo(position);
+ public void onStatePause() {
+ Log.i(TAG, "onStatePause " + " [" + this.hashCode() + "] ");
+ currentState = CURRENT_STATE_PAUSE;
+ startProgressTimer();
+ }
+
+ public void onStatePlaybackBufferingStart() {
+ Log.i(TAG, "onStatePlaybackBufferingStart " + " [" + this.hashCode() + "] ");
+ currentState = CURRENT_STATE_PLAYING_BUFFERING_START;
+ startProgressTimer();
+ }
+
+ public void onStateError() {
+ Log.i(TAG, "onStateError " + " [" + this.hashCode() + "] ");
+ currentState = CURRENT_STATE_ERROR;
+ cancelProgressTimer();
+ }
+
+ public void onStateAutoComplete() {
+ Log.i(TAG, "onStateAutoComplete " + " [" + this.hashCode() + "] ");
+ currentState = CURRENT_STATE_AUTO_COMPLETE;
+ cancelProgressTimer();
+ progressBar.setProgress(100);
+ currentTimeTextView.setText(totalTimeTextView.getText());
+ }
+
+ public void onInfo(int what, int extra) {
+ Log.d(TAG, "onInfo what - " + what + " extra - " + extra);
+ if (what == MediaPlayer.MEDIA_INFO_BUFFERING_START) {
+ if (currentState == CURRENT_STATE_PLAYING_BUFFERING_START) return;
+ BACKUP_PLAYING_BUFFERING_STATE = currentState;
+ onStatePlaybackBufferingStart();
+ Log.d(TAG, "MEDIA_INFO_BUFFERING_START");
+ } else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) {
+ if (BACKUP_PLAYING_BUFFERING_STATE != -1) {
+ if (currentState == CURRENT_STATE_PLAYING_BUFFERING_START) {
+ setState(BACKUP_PLAYING_BUFFERING_STATE);
+ }
+ BACKUP_PLAYING_BUFFERING_STATE = -1;
}
+ Log.d(TAG, "MEDIA_INFO_BUFFERING_END");
}
- startProgressTimer();
- setUiWitStateAndScreen(CURRENT_STATE_PLAYING);
}
- public void clearFullscreenLayout() {
- ViewGroup vp = (ViewGroup) (JCUtils.scanForActivity(getContext()))//.getWindow().getDecorView();
- .findViewById(Window.ID_ANDROID_CONTENT);
- View oldF = vp.findViewById(FULLSCREEN_ID);
- View oldT = vp.findViewById(TINY_ID);
- if (oldF != null) {
- vp.removeView(oldF);
+ public void onError(int what, int extra) {
+ Log.e(TAG, "onError " + what + " - " + extra + " [" + this.hashCode() + "] ");
+ if (what != 38 && what != -38 && extra != -38) {
+ onStateError();
+ if (isCurrentJcvd()) {
+ JCMediaManager.instance().releaseMediaPlayer();
+ }
}
- if (oldT != null) {
- vp.removeView(oldT);
+ }
+
+ public int widthRatio = 0;
+ public int heightRatio = 0;
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ if (currentScreen == SCREEN_WINDOW_FULLSCREEN || currentScreen == SCREEN_WINDOW_TINY) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ return;
}
- showSupportActionBar(getContext());
+ if (widthRatio != 0 && heightRatio != 0) {
+ int specWidth = MeasureSpec.getSize(widthMeasureSpec);
+ int specHeight = (int) ((specWidth * (float) heightRatio) / widthRatio);
+ setMeasuredDimension(specWidth, specHeight);
+
+ int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(specWidth, MeasureSpec.EXACTLY);
+ int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(specHeight, MeasureSpec.EXACTLY);
+ getChildAt(0).measure(childWidthMeasureSpec, childHeightMeasureSpec);
+ } else {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+
}
public void onAutoCompletion() {
@@ -459,7 +484,7 @@ public void onAutoCompletion() {
dismissProgressDialog();
dismissBrightnessDialog();
cancelProgressTimer();
- setUiWitStateAndScreen(CURRENT_STATE_AUTO_COMPLETE);
+ onStateAutoComplete();
if (currentScreen == SCREEN_WINDOW_FULLSCREEN) {
backPress();
@@ -476,7 +501,7 @@ public void onCompletion() {
JCUtils.saveProgress(getContext(), url, position);
}
cancelProgressTimer();
- setUiWitStateAndScreen(CURRENT_STATE_NORMAL);
+ onStateNormal();
// 清理缓存变量
textureViewContainer.removeView(JCMediaManager.textureView);
JCMediaManager.instance().currentVideoWidth = 0;
@@ -492,15 +517,64 @@ public void onCompletion() {
JCMediaManager.savedSurfaceTexture = null;
}
- //退出全屏和小窗的方法
- public void playOnThisJcvd() {
- Log.i(TAG, "playOnThisJcvd " + " [" + this.hashCode() + "] ");
- //1.清空全屏和小窗的jcvd
- currentState = JCVideoPlayerManager.getSecondFloor().currentState;
- clearFloatScreen();
- //2.在本jcvd上播放
- setUiWitStateAndScreen(currentState);
- addTextureView();
+ public void release() {
+ if (url.equals(JCMediaManager.CURRENT_PLAYING_URL) &&
+ (System.currentTimeMillis() - CLICK_QUIT_FULLSCREEN_TIME) > FULL_SCREEN_NORMAL_DELAY) {
+ //在非全屏的情况下只能backPress()
+ if (JCVideoPlayerManager.getSecondFloor() != null &&
+ JCVideoPlayerManager.getSecondFloor().currentScreen == SCREEN_WINDOW_FULLSCREEN) {//点击全屏
+ } else if (JCVideoPlayerManager.getSecondFloor() == null && JCVideoPlayerManager.getFirstFloor() != null &&
+ JCVideoPlayerManager.getFirstFloor().currentScreen == SCREEN_WINDOW_FULLSCREEN) {//直接全屏
+ } else {
+ Log.d(TAG, "release [" + this.hashCode() + "]");
+ releaseAllVideos();
+ }
+ }
+ }
+
+ public static void releaseAllVideos() {
+ if ((System.currentTimeMillis() - CLICK_QUIT_FULLSCREEN_TIME) > FULL_SCREEN_NORMAL_DELAY) {
+ Log.d(TAG, "releaseAllVideos");
+ JCVideoPlayerManager.completeAll();
+ JCMediaManager.instance().releaseMediaPlayer();
+ }
+ }
+
+ public void initTextureView() {
+ removeTextureView();
+ JCMediaManager.textureView = new JCResizeTextureView(getContext());
+ JCMediaManager.textureView.setSurfaceTextureListener(JCMediaManager.instance());
+ }
+
+ public void addTextureView() {
+ Log.d(TAG, "addTextureView [" + this.hashCode() + "] ");
+ FrameLayout.LayoutParams layoutParams =
+ new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ Gravity.CENTER);
+ textureViewContainer.addView(JCMediaManager.textureView, layoutParams);
+ }
+
+ public void removeTextureView() {
+ JCMediaManager.savedSurfaceTexture = null;
+ if (JCMediaManager.textureView != null && JCMediaManager.textureView.getParent() != null) {
+ ((ViewGroup) JCMediaManager.textureView.getParent()).removeView(JCMediaManager.textureView);
+ }
+ }
+
+ public void clearFullscreenLayout() {
+ ViewGroup vp = (ViewGroup) (JCUtils.scanForActivity(getContext()))//.getWindow().getDecorView();
+ .findViewById(Window.ID_ANDROID_CONTENT);
+ View oldF = vp.findViewById(FULLSCREEN_ID);
+ View oldT = vp.findViewById(TINY_ID);
+ if (oldF != null) {
+ vp.removeView(oldF);
+ }
+ if (oldT != null) {
+ vp.removeView(oldT);
+ }
+ showSupportActionBar(getContext());
}
public void clearFloatScreen() {
@@ -514,75 +588,94 @@ public void clearFloatScreen() {
JCVideoPlayerManager.setSecondFloor(null);
}
- public static long lastAutoFullscreenTime = 0;
-
- //重力感应的时候调用的函数,
- public void autoFullscreen(float x) {
- if (isCurrentJcvd()
- && currentState == CURRENT_STATE_PLAYING
- && currentScreen != SCREEN_WINDOW_FULLSCREEN
- && currentScreen != SCREEN_WINDOW_TINY) {
- if (x > 0) {
- JCUtils.getAppCompActivity(getContext()).setRequestedOrientation(
- ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
- } else {
- JCUtils.getAppCompActivity(getContext()).setRequestedOrientation(
- ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
- }
- startWindowFullscreen();
+ public void onVideoSizeChanged() {
+ Log.i(TAG, "onVideoSizeChanged " + " [" + this.hashCode() + "] ");
+ if (JCMediaManager.textureView != null) {
+ JCMediaManager.textureView.setVideoSize(JCMediaManager.instance().getVideoSize());
}
}
- public void autoQuitFullscreen() {
- if ((System.currentTimeMillis() - lastAutoFullscreenTime) > 2000
- && isCurrentJcvd()
- && currentState == CURRENT_STATE_PLAYING
- && currentScreen == SCREEN_WINDOW_FULLSCREEN) {
- lastAutoFullscreenTime = System.currentTimeMillis();
- backPress();
- }
- }
- public void onSeekComplete() {
+ public void startProgressTimer() {
+ cancelProgressTimer();
+ UPDATE_PROGRESS_TIMER = new Timer();
+ mProgressTimerTask = new ProgressTimerTask();
+ UPDATE_PROGRESS_TIMER.schedule(mProgressTimerTask, 0, 300);
+ }
+ public void cancelProgressTimer() {
+ if (UPDATE_PROGRESS_TIMER != null) {
+ UPDATE_PROGRESS_TIMER.cancel();
+ }
+ if (mProgressTimerTask != null) {
+ mProgressTimerTask.cancel();
+ }
}
- public void onError(int what, int extra) {
- Log.e(TAG, "onError " + what + " - " + extra + " [" + this.hashCode() + "] ");
- if (what != 38 && what != -38) {
- setUiWitStateAndScreen(CURRENT_STATE_ERROR);
- if (isCurrentJcvd()) {
- JCMediaManager.instance().releaseMediaPlayer();
+ public class ProgressTimerTask extends TimerTask {
+ @Override
+ public void run() {
+ if (currentState == CURRENT_STATE_PLAYING || currentState == CURRENT_STATE_PAUSE || currentState == CURRENT_STATE_PLAYING_BUFFERING_START) {
+// Log.v(TAG, "onProgressUpdate " + position + "/" + duration + " [" + this.hashCode() + "] ");
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ int position = getCurrentPositionWhenPlaying();
+ int duration = getDuration();
+ int progress = position * 100 / (duration == 0 ? 1 : duration);
+ setProgressAndText(progress, position, duration);
+ }
+ });
}
}
}
-
- public void onInfo(int what, int extra) {
- Log.d(TAG, "onInfo what - " + what + " extra - " + extra);
- if (what == MediaPlayer.MEDIA_INFO_BUFFERING_START) {
- if (currentState == CURRENT_STATE_PLAYING_BUFFERING_START) return;
- BACKUP_PLAYING_BUFFERING_STATE = currentState;
- setUiWitStateAndScreen(CURRENT_STATE_PLAYING_BUFFERING_START);//没这个case
- Log.d(TAG, "MEDIA_INFO_BUFFERING_START");
- } else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) {
- if (BACKUP_PLAYING_BUFFERING_STATE != -1) {
- setUiWitStateAndScreen(BACKUP_PLAYING_BUFFERING_STATE);
- BACKUP_PLAYING_BUFFERING_STATE = -1;
- }
- Log.d(TAG, "MEDIA_INFO_BUFFERING_END");
+ public void setProgressAndText(int progress, int position, int duration) {
+ if (!mTouchingProgressBar) {
+ if (progress != 0) progressBar.setProgress(progress);
}
+ if (position != 0) currentTimeTextView.setText(JCUtils.stringForTime(position));
+ totalTimeTextView.setText(JCUtils.stringForTime(duration));
}
- public void onVideoSizeChanged() {
- Log.i(TAG, "onVideoSizeChanged " + " [" + this.hashCode() + "] ");
- if (JCMediaManager.textureView != null) {
- JCMediaManager.textureView.setVideoSize(JCMediaManager.instance().getVideoSize());
+ public void setBufferProgress(int bufferProgress) {
+ if (bufferProgress != 0) progressBar.setSecondaryProgress(bufferProgress);
+ }
+
+ public void resetProgressAndTime() {
+ progressBar.setProgress(0);
+ progressBar.setSecondaryProgress(0);
+ currentTimeTextView.setText(JCUtils.stringForTime(0));
+ totalTimeTextView.setText(JCUtils.stringForTime(0));
+ }
+
+ public int getCurrentPositionWhenPlaying() {
+ int position = 0;
+ if (JCMediaManager.instance().mediaPlayer == null)
+ return position;//这行代码不应该在这,如果代码和逻辑万无一失的话,心头之恨呐
+ if (currentState == CURRENT_STATE_PLAYING ||
+ currentState == CURRENT_STATE_PAUSE ||
+ currentState == CURRENT_STATE_PLAYING_BUFFERING_START) {
+ try {
+ position = JCMediaManager.instance().mediaPlayer.getCurrentPosition();
+ } catch (IllegalStateException e) {
+ e.printStackTrace();
+ return position;
+ }
}
+ return position;
}
- @Override
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ public int getDuration() {
+ int duration = 0;
+ if (JCMediaManager.instance().mediaPlayer == null) return duration;
+ try {
+ duration = JCMediaManager.instance().mediaPlayer.getDuration();
+ } catch (IllegalStateException e) {
+ e.printStackTrace();
+ return duration;
+ }
+ return duration;
}
@Override
@@ -613,30 +706,8 @@ public void onStopTrackingTouch(SeekBar seekBar) {
Log.i(TAG, "seekTo " + time + " [" + this.hashCode() + "] ");
}
- public static boolean backPress() {
- Log.i(TAG, "backPress");
- if ((System.currentTimeMillis() - CLICK_QUIT_FULLSCREEN_TIME) < FULL_SCREEN_NORMAL_DELAY)
- return false;
- if (JCVideoPlayerManager.getSecondFloor() != null) {
- CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis();
- JCVideoPlayer jcVideoPlayer = JCVideoPlayerManager.getSecondFloor();
- jcVideoPlayer.onEvent(jcVideoPlayer.currentScreen == JCVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN ?
- JCUserAction.ON_QUIT_FULLSCREEN :
- JCUserAction.ON_QUIT_TINYSCREEN);
- JCVideoPlayerManager.getFirstFloor().playOnThisJcvd();
- return true;
- } else if (JCVideoPlayerManager.getFirstFloor() != null &&
- (JCVideoPlayerManager.getFirstFloor().currentScreen == SCREEN_WINDOW_FULLSCREEN ||
- JCVideoPlayerManager.getFirstFloor().currentScreen == SCREEN_WINDOW_TINY)) {//以前我总想把这两个判断写到一起,这分明是两个独立是逻辑
- CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis();
- //直接退出全屏和小窗
- JCVideoPlayerManager.getCurrentJcvd().currentState = CURRENT_STATE_NORMAL;
- JCVideoPlayerManager.getFirstFloor().clearFloatScreen();
- JCMediaManager.instance().releaseMediaPlayer();
- JCVideoPlayerManager.setFirstFloor(null);
- return true;
- }
- return false;
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
}
public void startWindowFullscreen() {
@@ -660,7 +731,7 @@ public void startWindowFullscreen() {
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
vp.addView(jcVideoPlayer, lp);
jcVideoPlayer.setUp(url, JCVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN, objects);
- jcVideoPlayer.setUiWitStateAndScreen(currentState);
+ jcVideoPlayer.setState(currentState);
jcVideoPlayer.addTextureView();
JCVideoPlayerManager.setSecondFloor(jcVideoPlayer);
// final Animation ra = AnimationUtils.loadAnimation(getContext(), R.anim.start_fullscreen);
@@ -671,7 +742,6 @@ public void startWindowFullscreen() {
}
}
-
public void startWindowTiny() {
Log.i(TAG, "startWindowTiny " + " [" + this.hashCode() + "] ");
onEvent(JCUserAction.ON_ENTER_TINYSCREEN);
@@ -692,7 +762,7 @@ public void startWindowTiny() {
lp.gravity = Gravity.RIGHT | Gravity.BOTTOM;
vp.addView(jcVideoPlayer, lp);
jcVideoPlayer.setUp(url, JCVideoPlayerStandard.SCREEN_WINDOW_TINY, objects);
- jcVideoPlayer.setUiWitStateAndScreen(currentState);
+ jcVideoPlayer.setState(currentState);
jcVideoPlayer.addTextureView();
JCVideoPlayerManager.setSecondFloor(jcVideoPlayer);
} catch (InstantiationException e) {
@@ -702,144 +772,6 @@ public void startWindowTiny() {
}
}
- public class ProgressTimerTask extends TimerTask {
- @Override
- public void run() {
- if (currentState == CURRENT_STATE_PLAYING || currentState == CURRENT_STATE_PAUSE || currentState == CURRENT_STATE_PLAYING_BUFFERING_START) {
-// Log.v(TAG, "onProgressUpdate " + position + "/" + duration + " [" + this.hashCode() + "] ");
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- setProgressAndText();
- }
- });
- }
- }
- }
-
- public int getCurrentPositionWhenPlaying() {
- int position = 0;
- if (JCMediaManager.instance().mediaPlayer == null)
- return position;//这行代码不应该在这,如果代码和逻辑万无一失的话,心头之恨呐
- if (currentState == CURRENT_STATE_PLAYING ||
- currentState == CURRENT_STATE_PAUSE ||
- currentState == CURRENT_STATE_PLAYING_BUFFERING_START) {
- try {
- position = JCMediaManager.instance().mediaPlayer.getCurrentPosition();
- } catch (IllegalStateException e) {
- e.printStackTrace();
- return position;
- }
- }
- return position;
- }
-
- public int getDuration() {
- int duration = 0;
- if (JCMediaManager.instance().mediaPlayer == null) return duration;
- try {
- duration = JCMediaManager.instance().mediaPlayer.getDuration();
- } catch (IllegalStateException e) {
- e.printStackTrace();
- return duration;
- }
- return duration;
- }
-
- public void setProgressAndText() {
- int position = getCurrentPositionWhenPlaying();
- int duration = getDuration();
- int progress = position * 100 / (duration == 0 ? 1 : duration);
- if (!mTouchingProgressBar) {
- if (progress != 0) progressBar.setProgress(progress);
- }
- if (position != 0) currentTimeTextView.setText(JCUtils.stringForTime(position));
- totalTimeTextView.setText(JCUtils.stringForTime(duration));
- }
-
- public void setBufferProgress(int bufferProgress) {
- if (bufferProgress != 0) progressBar.setSecondaryProgress(bufferProgress);
- }
-
- public void resetProgressAndTime() {
- progressBar.setProgress(0);
- progressBar.setSecondaryProgress(0);
- currentTimeTextView.setText(JCUtils.stringForTime(0));
- totalTimeTextView.setText(JCUtils.stringForTime(0));
- }
-
- public static AudioManager.OnAudioFocusChangeListener onAudioFocusChangeListener = new AudioManager.OnAudioFocusChangeListener() {
- @Override
- public void onAudioFocusChange(int focusChange) {
- switch (focusChange) {
- case AudioManager.AUDIOFOCUS_GAIN:
- break;
- case AudioManager.AUDIOFOCUS_LOSS:
- releaseAllVideos();
- Log.d(TAG, "AUDIOFOCUS_LOSS [" + this.hashCode() + "]");
- break;
- case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
- try {
- if (JCMediaManager.instance().mediaPlayer != null &&
- JCMediaManager.instance().mediaPlayer.isPlaying()) {
- JCMediaManager.instance().mediaPlayer.pause();
- }
- } catch (IllegalStateException e) {
- e.printStackTrace();
- }
- Log.d(TAG, "AUDIOFOCUS_LOSS_TRANSIENT [" + this.hashCode() + "]");
- break;
- case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
- break;
- }
- }
- };
-
- public void release() {
- if (url.equals(JCMediaManager.CURRENT_PLAYING_URL) &&
- (System.currentTimeMillis() - CLICK_QUIT_FULLSCREEN_TIME) > FULL_SCREEN_NORMAL_DELAY) {
- //在非全屏的情况下只能backPress()
- if (JCVideoPlayerManager.getSecondFloor() != null &&
- JCVideoPlayerManager.getSecondFloor().currentScreen == SCREEN_WINDOW_FULLSCREEN) {//点击全屏
- } else if (JCVideoPlayerManager.getSecondFloor() == null && JCVideoPlayerManager.getFirstFloor() != null &&
- JCVideoPlayerManager.getFirstFloor().currentScreen == SCREEN_WINDOW_FULLSCREEN) {//直接全屏
- } else {
- Log.d(TAG, "release [" + this.hashCode() + "]");
- releaseAllVideos();
- }
- }
- }
-
- //isCurrentJcvd and isCurrenPlayUrl should be two logic methods,isCurrentJcvd is for different jcvd with same
- //url when fullscreen or tiny screen. isCurrenPlayUrl is to find where is myself when back from tiny screen.
- //Sometimes they are overlap.
- public boolean isCurrentJcvd() {//虽然看这个函数很不爽,但是干不掉
- return JCVideoPlayerManager.getCurrentJcvd() != null
- && JCVideoPlayerManager.getCurrentJcvd() == this;
- }
-
-// public boolean isCurrenPlayingUrl() {
-// return url.equals(JCMediaManager.CURRENT_PLAYING_URL);
-// }
-
- public static void releaseAllVideos() {
- if ((System.currentTimeMillis() - CLICK_QUIT_FULLSCREEN_TIME) > FULL_SCREEN_NORMAL_DELAY) {
- Log.d(TAG, "releaseAllVideos");
- JCVideoPlayerManager.completeAll();
- JCMediaManager.instance().releaseMediaPlayer();
- }
- }
-
- public static void setJcUserAction(JCUserAction jcUserEvent) {
- JC_USER_EVENT = jcUserEvent;
- }
-
- public void onEvent(int type) {
- if (JC_USER_EVENT != null && isCurrentJcvd()) {
- JC_USER_EVENT.onEvent(type, url, currentScreen, objects);
- }
- }
-
public static void startFullscreen(Context context, Class _class, String url, Object... objects) {
hideSupportActionBar(context);
JCUtils.getAppCompActivity(context).setRequestedOrientation(FULLSCREEN_ORIENTATION);
@@ -868,30 +800,110 @@ public static void startFullscreen(Context context, Class _class, String url, Ob
}
}
- public static void hideSupportActionBar(Context context) {
+
+ //isCurrentJcvd and isCurrenPlayUrl should be two logic methods,isCurrentJcvd is for different jcvd with same
+ //url when fullscreen or tiny screen. isCurrenPlayUrl is to find where is myself when back from tiny screen.
+ //Sometimes they are overlap.
+ public boolean isCurrentJcvd() {//虽然看这个函数很不爽,但是干不掉
+ return JCVideoPlayerManager.getCurrentJcvd() != null
+ && JCVideoPlayerManager.getCurrentJcvd() == this;
+ }
+
+ // public boolean isCurrenPlayingUrl() {
+// return url.equals(JCMediaManager.CURRENT_PLAYING_URL);
+// }
+
+ //退出全屏和小窗的方法
+ public void playOnThisJcvd() {
+ Log.i(TAG, "playOnThisJcvd " + " [" + this.hashCode() + "] ");
+ //1.清空全屏和小窗的jcvd
+ currentState = JCVideoPlayerManager.getSecondFloor().currentState;
+ clearFloatScreen();
+ //2.在本jcvd上播放
+ setState(currentState);
+ addTextureView();
+ }
+
+ public static boolean backPress() {
+ Log.i(TAG, "backPress");
+ if ((System.currentTimeMillis() - CLICK_QUIT_FULLSCREEN_TIME) < FULL_SCREEN_NORMAL_DELAY)
+ return false;
+ if (JCVideoPlayerManager.getSecondFloor() != null) {
+ CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis();
+ JCVideoPlayer jcVideoPlayer = JCVideoPlayerManager.getSecondFloor();
+ jcVideoPlayer.onEvent(jcVideoPlayer.currentScreen == JCVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN ?
+ JCUserAction.ON_QUIT_FULLSCREEN :
+ JCUserAction.ON_QUIT_TINYSCREEN);
+ JCVideoPlayerManager.getFirstFloor().playOnThisJcvd();
+ return true;
+ } else if (JCVideoPlayerManager.getFirstFloor() != null &&
+ (JCVideoPlayerManager.getFirstFloor().currentScreen == SCREEN_WINDOW_FULLSCREEN ||
+ JCVideoPlayerManager.getFirstFloor().currentScreen == SCREEN_WINDOW_TINY)) {//以前我总想把这两个判断写到一起,这分明是两个独立是逻辑
+ CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis();
+ //直接退出全屏和小窗
+ JCVideoPlayerManager.getCurrentJcvd().currentState = CURRENT_STATE_NORMAL;
+ JCVideoPlayerManager.getFirstFloor().clearFloatScreen();
+ JCMediaManager.instance().releaseMediaPlayer();
+ JCVideoPlayerManager.setFirstFloor(null);
+ return true;
+ }
+ return false;
+ }
+
+ public static void showSupportActionBar(Context context) {
if (ACTION_BAR_EXIST) {
ActionBar ab = JCUtils.getAppCompActivity(context).getSupportActionBar();
if (ab != null) {
ab.setShowHideAnimationEnabled(false);
- ab.hide();
+ ab.show();
}
}
if (TOOL_BAR_EXIST) {
- JCUtils.getAppCompActivity(context).getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ JCUtils.getAppCompActivity(context).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
- public static void showSupportActionBar(Context context) {
+ public static void hideSupportActionBar(Context context) {
if (ACTION_BAR_EXIST) {
ActionBar ab = JCUtils.getAppCompActivity(context).getSupportActionBar();
if (ab != null) {
ab.setShowHideAnimationEnabled(false);
- ab.show();
+ ab.hide();
}
}
if (TOOL_BAR_EXIST) {
- JCUtils.getAppCompActivity(context).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ JCUtils.getAppCompActivity(context).getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ }
+ }
+
+ public static long lastAutoFullscreenTime = 0;
+
+ //重力感应的时候调用的函数,
+ public void autoFullscreen(float x) {
+ if (isCurrentJcvd()
+ && currentState == CURRENT_STATE_PLAYING
+ && currentScreen != SCREEN_WINDOW_FULLSCREEN
+ && currentScreen != SCREEN_WINDOW_TINY) {
+ if (x > 0) {
+ JCUtils.getAppCompActivity(getContext()).setRequestedOrientation(
+ ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+ } else {
+ JCUtils.getAppCompActivity(getContext()).setRequestedOrientation(
+ ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
+ }
+ onEvent(JCUserAction.ON_ENTER_FULLSCREEN);
+ startWindowFullscreen();
+ }
+ }
+
+ public void autoQuitFullscreen() {
+ if ((System.currentTimeMillis() - lastAutoFullscreenTime) > 2000
+ && isCurrentJcvd()
+ && currentState == CURRENT_STATE_PLAYING
+ && currentScreen == SCREEN_WINDOW_FULLSCREEN) {
+ lastAutoFullscreenTime = System.currentTimeMillis();
+ backPress();
}
}
@@ -921,7 +933,50 @@ public static void clearSavedProgress(Context context, String url) {
JCUtils.clearSavedProgress(context, url);
}
- public void showWifiDialog() {
+ public static void setJcUserAction(JCUserAction jcUserEvent) {
+ JC_USER_EVENT = jcUserEvent;
+ }
+
+ public void onEvent(int type) {
+ if (JC_USER_EVENT != null && isCurrentJcvd()) {
+ JC_USER_EVENT.onEvent(type, url, currentScreen, objects);
+ }
+ }
+
+ public static AudioManager.OnAudioFocusChangeListener onAudioFocusChangeListener = new AudioManager.OnAudioFocusChangeListener() {
+ @Override
+ public void onAudioFocusChange(int focusChange) {
+ switch (focusChange) {
+ case AudioManager.AUDIOFOCUS_GAIN:
+ break;
+ case AudioManager.AUDIOFOCUS_LOSS:
+ releaseAllVideos();
+ Log.d(TAG, "AUDIOFOCUS_LOSS [" + this.hashCode() + "]");
+ break;
+ case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
+ try {
+ if (JCMediaManager.instance().mediaPlayer != null &&
+ JCMediaManager.instance().mediaPlayer.isPlaying()) {
+ JCMediaManager.instance().mediaPlayer.pause();
+ }
+ } catch (IllegalStateException e) {
+ e.printStackTrace();
+ }
+ Log.d(TAG, "AUDIOFOCUS_LOSS_TRANSIENT [" + this.hashCode() + "]");
+ break;
+ case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
+ break;
+ }
+ }
+ };
+
+ //TODO 是否有用
+ public void onSeekComplete() {
+
+ }
+
+
+ public void showWifiDialog(int event) {
}
public void showProgressDialog(float deltaX,
@@ -949,6 +1004,4 @@ public void dismissBrightnessDialog() {
}
- public abstract int getLayoutId();
-
}
diff --git a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayerSimple.java b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayerSimple.java
index 8517877d8..81d5508c5 100644
--- a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayerSimple.java
+++ b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayerSimple.java
@@ -33,26 +33,26 @@ public void setUp(String url, int screen, Object... objects) {
fullscreenButton.setVisibility(View.GONE);
}
- @Override
- public void setUiWitStateAndScreen(int state) {
- super.setUiWitStateAndScreen(state);
- switch (currentState) {
- case CURRENT_STATE_NORMAL:
- startButton.setVisibility(View.VISIBLE);
- break;
- case CURRENT_STATE_PREPARING:
- startButton.setVisibility(View.INVISIBLE);
- break;
- case CURRENT_STATE_PLAYING:
- startButton.setVisibility(View.VISIBLE);
- break;
- case CURRENT_STATE_PAUSE:
- break;
- case CURRENT_STATE_ERROR:
- break;
- }
- updateStartImage();
- }
+// @Override
+// public void setUiWitStateAndScreen(int state) {
+// super.setUiWitStateAndScreen(state);
+// switch (currentState) {
+// case CURRENT_STATE_NORMAL:
+// startButton.setVisibility(View.VISIBLE);
+// break;
+// case CURRENT_STATE_PREPARING:
+// startButton.setVisibility(View.INVISIBLE);
+// break;
+// case CURRENT_STATE_PLAYING:
+// startButton.setVisibility(View.VISIBLE);
+// break;
+// case CURRENT_STATE_PAUSE:
+// break;
+// case CURRENT_STATE_ERROR:
+// break;
+// }
+// updateStartImage();
+// }
private void updateStartImage() {
if (currentState == CURRENT_STATE_PLAYING) {
diff --git a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayerStandard.java b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayerStandard.java
index f51d96366..f8ccb5928 100644
--- a/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayerStandard.java
+++ b/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayerStandard.java
@@ -103,38 +103,51 @@ public int getLayoutId() {
}
@Override
- public void setUiWitStateAndScreen(int state) {
- super.setUiWitStateAndScreen(state);
- switch (currentState) {
- case CURRENT_STATE_NORMAL:
- changeUiToNormal();
- break;
- case CURRENT_STATE_PREPARING:
- changeUiToPreparingShow();
- startDismissControlViewTimer();
- break;
- case CURRENT_STATE_PLAYING:
- changeUiToPlayingShow();
- startDismissControlViewTimer();
- break;
- case CURRENT_STATE_PAUSE:
- changeUiToPauseShow();
- cancelDismissControlViewTimer();
- break;
- case CURRENT_STATE_ERROR:
- changeUiToError();
- break;
- case CURRENT_STATE_AUTO_COMPLETE:
- changeUiToCompleteShow();
- cancelDismissControlViewTimer();
- bottomProgressBar.setProgress(100);
- break;
- case CURRENT_STATE_PLAYING_BUFFERING_START:
- changeUiToPlayingBufferingShow();
- break;
- }
+ public void onStateNormal() {
+ super.onStateNormal();
+ changeUiToNormal();
+ }
+
+ @Override
+ public void onStatePreparing() {
+ super.onStatePreparing();
+ changeUiToPreparingShow();
+ startDismissControlViewTimer();
}
+ @Override
+ public void onStatePlaying() {
+ super.onStatePlaying();
+ changeUiToPlayingShow();
+ startDismissControlViewTimer();
+ }
+
+ @Override
+ public void onStatePause() {
+ super.onStatePause();
+ changeUiToPauseShow();
+ cancelDismissControlViewTimer();
+ }
+
+ @Override
+ public void onStatePlaybackBufferingStart() {
+ super.onStatePlaybackBufferingStart();
+ changeUiToPlayingBufferingShow();
+ }
+
+ @Override
+ public void onStateError() {
+ super.onStateError();
+ changeUiToError();
+ }
+
+ @Override
+ public void onStateAutoComplete() {
+ super.onStateAutoComplete();
+ changeUiToCompleteShow();
+ cancelDismissControlViewTimer();
+ bottomProgressBar.setProgress(100);
+ }
@Override
public boolean onTouch(View v, MotionEvent event) {
@@ -183,9 +196,10 @@ public void onClick(View v) {
if (currentState == CURRENT_STATE_NORMAL) {
if (!url.startsWith("file") && !url.startsWith("/") &&
!JCUtils.isWifiConnected(getContext()) && !WIFI_TIP_DIALOG_SHOWED) {
- showWifiDialog();
+ showWifiDialog(JCUserActionStandard.ON_CLICK_START_THUMB);
return;
}
+ onEvent(JCUserActionStandard.ON_CLICK_START_THUMB);
startVideo();
} else if (currentState == CURRENT_STATE_AUTO_COMPLETE) {
onClickUiToggle();
@@ -201,14 +215,15 @@ public void onClick(View v) {
@Override
- public void showWifiDialog() {
- super.showWifiDialog();
+ public void showWifiDialog(int action) {
+ super.showWifiDialog(action);
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setMessage(getResources().getString(R.string.tips_not_wifi));
builder.setPositiveButton(getResources().getString(R.string.tips_not_wifi_confirm), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
+ onEvent(JCUserActionStandard.ON_CLICK_START_THUMB);
startVideo();
WIFI_TIP_DIALOG_SHOWED = true;
}
@@ -248,11 +263,6 @@ public void onStopTrackingTouch(SeekBar seekBar) {
startDismissControlViewTimer();
}
- public void startVideo() {
- prepareMediaPlayer();
- onEvent(JCUserActionStandard.ON_CLICK_START_THUMB);
- }
-
public void onClickUiToggle() {
if (currentState == CURRENT_STATE_PREPARING) {
if (bottomContainer.getVisibility() == View.VISIBLE) {
@@ -317,11 +327,8 @@ public void onCLickUiToggleToClear() {
}
@Override
- public void setProgressAndText() {
- super.setProgressAndText();
- int position = getCurrentPositionWhenPlaying();
- int duration = getDuration();
- int progress = position * 100 / (duration == 0 ? 1 : duration);
+ public void setProgressAndText(int progress, int position, int duration) {
+ super.setProgressAndText(progress, position, duration);
if (progress != 0) bottomProgressBar.setProgress(progress);
}
@@ -601,15 +608,7 @@ public void showProgressDialog(float deltaX, String seekTime, int seekTimePositi
mDialogSeekTime = ((TextView) localView.findViewById(R.id.tv_current));
mDialogTotalTime = ((TextView) localView.findViewById(R.id.tv_duration));
mDialogIcon = ((ImageView) localView.findViewById(R.id.duration_image_tip));
- mProgressDialog = new Dialog(getContext(), R.style.jc_style_dialog_progress);
- mProgressDialog.setContentView(localView);
- mProgressDialog.getWindow().addFlags(Window.FEATURE_ACTION_BAR);
- mProgressDialog.getWindow().addFlags(32);
- mProgressDialog.getWindow().addFlags(16);
- mProgressDialog.getWindow().setLayout(-2, -2);
- WindowManager.LayoutParams localLayoutParams = mProgressDialog.getWindow().getAttributes();
- localLayoutParams.gravity = Gravity.CENTER;
- mProgressDialog.getWindow().setAttributes(localLayoutParams);
+ mProgressDialog = createDialogWithView(localView);
}
if (!mProgressDialog.isShowing()) {
mProgressDialog.show();
@@ -647,15 +646,7 @@ public void showVolumeDialog(float deltaY, int volumePercent) {
mDialogVolumeImageView = ((ImageView) localView.findViewById(R.id.volume_image_tip));
mDialogVolumeTextView = ((TextView) localView.findViewById(R.id.tv_volume));
mDialogVolumeProgressBar = ((ProgressBar) localView.findViewById(R.id.volume_progressbar));
- mVolumeDialog = new Dialog(getContext(), R.style.jc_style_dialog_progress);
- mVolumeDialog.setContentView(localView);
- mVolumeDialog.getWindow().addFlags(8);
- mVolumeDialog.getWindow().addFlags(32);
- mVolumeDialog.getWindow().addFlags(16);
- mVolumeDialog.getWindow().setLayout(-2, -2);
- WindowManager.LayoutParams localLayoutParams = mVolumeDialog.getWindow().getAttributes();
- localLayoutParams.gravity = Gravity.CENTER;
- mVolumeDialog.getWindow().setAttributes(localLayoutParams);
+ mVolumeDialog = createDialogWithView(localView);
}
if (!mVolumeDialog.isShowing()) {
mVolumeDialog.show();
@@ -694,16 +685,7 @@ public void showBrightnessDialog(int brightnessPercent) {
View localView = LayoutInflater.from(getContext()).inflate(R.layout.jc_dialog_brightness, null);
mDialogBrightnessTextView = ((TextView) localView.findViewById(R.id.tv_brightness));
mDialogBrightnessProgressBar = ((ProgressBar) localView.findViewById(R.id.brightness_progressbar));
- mBrightnessDialog = new Dialog(getContext(), R.style.jc_style_dialog_progress);
- mBrightnessDialog.setContentView(localView);
- mBrightnessDialog.getWindow().addFlags(Window.FEATURE_ACTION_BAR);
- mBrightnessDialog.getWindow().addFlags(32);
- mBrightnessDialog.getWindow().addFlags(16);
- mBrightnessDialog.getWindow().setLayout(-2, -2);
- WindowManager.LayoutParams localLayoutParams = mBrightnessDialog.getWindow().getAttributes();
- localLayoutParams.gravity = Gravity.CENTER;
- mBrightnessDialog.getWindow().setAttributes(localLayoutParams);
-
+ mBrightnessDialog = createDialogWithView(localView);
}
if (!mBrightnessDialog.isShowing()) {
mBrightnessDialog.show();
@@ -726,6 +708,20 @@ public void dismissBrightnessDialog() {
}
}
+ public Dialog createDialogWithView(View localView) {
+ Dialog dialog = new Dialog(getContext(), R.style.jc_style_dialog_progress);
+ dialog.setContentView(localView);
+ Window window = dialog.getWindow();
+ window.addFlags(Window.FEATURE_ACTION_BAR);
+ window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
+ window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
+ window.setLayout(-2, -2);
+ WindowManager.LayoutParams localLayoutParams = window.getAttributes();
+ localLayoutParams.gravity = Gravity.CENTER;
+ window.setAttributes(localLayoutParams);
+ return dialog;
+ }
+
public void startDismissControlViewTimer() {
cancelDismissControlViewTimer();
DISMISS_CONTROL_VIEW_TIMER = new Timer();
diff --git a/jcvideoplayer-lib/src/main/res/drawable/jc_bottom_progress.xml b/jcvideoplayer-lib/src/main/res/drawable/jc_bottom_progress.xml
index 224a54cf8..5db29499f 100644
--- a/jcvideoplayer-lib/src/main/res/drawable/jc_bottom_progress.xml
+++ b/jcvideoplayer-lib/src/main/res/drawable/jc_bottom_progress.xml
@@ -3,16 +3,16 @@
-
-
-
+
+
-
-
-
+
+
@@ -20,8 +20,8 @@
-
-
+
+
diff --git a/jcvideoplayer-lib/src/main/res/drawable/jc_bottom_seek_progress.xml b/jcvideoplayer-lib/src/main/res/drawable/jc_bottom_seek_progress.xml
index c39618817..212fccc32 100644
--- a/jcvideoplayer-lib/src/main/res/drawable/jc_bottom_seek_progress.xml
+++ b/jcvideoplayer-lib/src/main/res/drawable/jc_bottom_seek_progress.xml
@@ -3,7 +3,7 @@
-
-
+
@@ -11,7 +11,7 @@
-
+
@@ -20,7 +20,7 @@
-
+
diff --git a/jcvideoplayer-lib/src/main/res/drawable/jc_dialog_progress_bg.xml b/jcvideoplayer-lib/src/main/res/drawable/jc_dialog_progress_bg.xml
index 8ab0b4400..421a56c7a 100644
--- a/jcvideoplayer-lib/src/main/res/drawable/jc_dialog_progress_bg.xml
+++ b/jcvideoplayer-lib/src/main/res/drawable/jc_dialog_progress_bg.xml
@@ -2,8 +2,8 @@
+ android:bottomLeftRadius="6dp"
+ android:bottomRightRadius="6dp"
+ android:topLeftRadius="6dp"
+ android:topRightRadius="6dp" />
\ No newline at end of file
diff --git a/jcvideoplayer-lib/src/main/res/drawable/jc_seek_thumb_normal.xml b/jcvideoplayer-lib/src/main/res/drawable/jc_seek_thumb_normal.xml
index 67a1486ed..c8c07316c 100644
--- a/jcvideoplayer-lib/src/main/res/drawable/jc_seek_thumb_normal.xml
+++ b/jcvideoplayer-lib/src/main/res/drawable/jc_seek_thumb_normal.xml
@@ -3,6 +3,6 @@
xmlns:android="http://schemas.android.com/apk/res/android">
+ android:height="15dp"
+ android:width="15dp" />
diff --git a/jcvideoplayer-lib/src/main/res/drawable/jc_seek_thumb_pressed.xml b/jcvideoplayer-lib/src/main/res/drawable/jc_seek_thumb_pressed.xml
index b228cd444..467d61404 100644
--- a/jcvideoplayer-lib/src/main/res/drawable/jc_seek_thumb_pressed.xml
+++ b/jcvideoplayer-lib/src/main/res/drawable/jc_seek_thumb_pressed.xml
@@ -3,6 +3,6 @@
xmlns:android="http://schemas.android.com/apk/res/android">
+ android:height="15dp"
+ android:width="15dp" />
diff --git a/jcvideoplayer-lib/src/main/res/drawable/jc_volume_progress_bg.xml b/jcvideoplayer-lib/src/main/res/drawable/jc_volume_progress_bg.xml
index 7b6da0902..a38807442 100644
--- a/jcvideoplayer-lib/src/main/res/drawable/jc_volume_progress_bg.xml
+++ b/jcvideoplayer-lib/src/main/res/drawable/jc_volume_progress_bg.xml
@@ -3,7 +3,7 @@
-
-
+
-
@@ -12,7 +12,7 @@
android:gravity="bottom">
-
+
diff --git a/jcvideoplayer-lib/src/main/res/layout/jc_layout_standard.xml b/jcvideoplayer-lib/src/main/res/layout/jc_layout_standard.xml
index 7c5a99ea6..2118cff45 100644
--- a/jcvideoplayer-lib/src/main/res/layout/jc_layout_standard.xml
+++ b/jcvideoplayer-lib/src/main/res/layout/jc_layout_standard.xml
@@ -51,8 +51,8 @@
android:layout_weight="1.0"
android:background="@null"
android:max="100"
- android:maxHeight="1.0dip"
- android:minHeight="1.0dip"
+ android:maxHeight="1dp"
+ android:minHeight="1dp"
android:paddingBottom="8dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
@@ -69,10 +69,10 @@
diff --git a/jcvideoplayer-lib/src/main/res/values-pt/strings.xml b/jcvideoplayer-lib/src/main/res/values-pt/strings.xml
index de281bc76..db0da7abe 100644
--- a/jcvideoplayer-lib/src/main/res/values-pt/strings.xml
+++ b/jcvideoplayer-lib/src/main/res/values-pt/strings.xml
@@ -1,7 +1,7 @@
- Você está usando a rede móvel, você deseja mesmo ver o video?
+ Você está usando a rede móvel, você deseja mesmo ver o vídeo?
Continuar
Parar
- Sem Vídeo
+ Sem vídeo
diff --git a/jcvideoplayer-lib/src/main/res/values/strings.xml b/jcvideoplayer-lib/src/main/res/values/strings.xml
index e7fddf091..ba99f0504 100644
--- a/jcvideoplayer-lib/src/main/res/values/strings.xml
+++ b/jcvideoplayer-lib/src/main/res/values/strings.xml
@@ -3,5 +3,5 @@
You are currently using the mobile network, the player will continue to consume traffic
Resume
Stop play
- No mUrl
+ No url
diff --git a/jcvideoplayer-lib/src/main/res/values/styles.xml b/jcvideoplayer-lib/src/main/res/values/styles.xml
index bfbd52427..7e7eb8f95 100644
--- a/jcvideoplayer-lib/src/main/res/values/styles.xml
+++ b/jcvideoplayer-lib/src/main/res/values/styles.xml
@@ -13,15 +13,4 @@
- @android:anim/fade_out
-