Skip to content

Commit

Permalink
Merge pull request #356 from tanhx2008/dev
Browse files Browse the repository at this point in the history
release 1.4.0
  • Loading branch information
jpxiong authored Nov 16, 2016
2 parents 172eba1 + 21f1b8e commit 41ef7b9
Show file tree
Hide file tree
Showing 25 changed files with 181 additions and 69 deletions.
6 changes: 3 additions & 3 deletions PLDroidPlayerDemo/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.pili.pldroid.playerdemo"
minSdkVersion 9
targetSdkVersion 22
versionCode 3
versionName "1.3.2"
versionCode 4
versionName "1.4.0"
}
buildTypes {
release {
Expand All @@ -20,8 +20,8 @@ android {
}

dependencies {
compile files('libs/pldroid-player-1.4.0.jar')
compile 'com.android.support:appcompat-v7:22+'
compile files('libs/pldroid-player-1.3.2.jar')
compile 'com.qiniu:happy-dns:0.2.+'
compile 'com.qiniu.pili:pili-android-qos:0.8.+'
}
Binary file removed PLDroidPlayerDemo/app/libs/pldroid-player-1.3.2.jar
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
Expand Down Expand Up @@ -47,6 +48,9 @@ protected void onCreate(Bundle savedInstanceState) {
e.printStackTrace();
}

TextView mVersionInfoTextView = (TextView) findViewById(R.id.version_info);
mVersionInfoTextView.setText("Version: " + BuildConfig.VERSION_NAME);

mEditText = (EditText)findViewById(R.id.VideoPathEdit);
mEditText.setText(DEFAULT_TEST_URL);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ public void onClickStop(View v) {
}

public void release() {
mMediaPlayer.stop();
mMediaPlayer.release();
mMediaPlayer = null;
if (mMediaPlayer != null) {
mMediaPlayer.stop();
mMediaPlayer.release();
mMediaPlayer = null;
}
}

private void prepare() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/**
* This demo shows how to use PLMediaPlayer API playing video stream
*/
public class PLMediaPlayerActivity extends AppCompatActivity {
public class PLMediaPlayerActivity extends VideoPlayerBaseActivity {

private static final String TAG = PLMediaPlayerActivity.class.getSimpleName();

Expand All @@ -48,7 +48,6 @@ public class PLMediaPlayerActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_media_player);
mLoadingView = findViewById(R.id.LoadingView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;

import com.pili.pldroid.player.AVOptions;
Expand All @@ -18,7 +17,7 @@
/**
* This is a demo activity of PLVideoTextureView
*/
public class PLVideoTextureActivity extends AppCompatActivity {
public class PLVideoTextureActivity extends VideoPlayerBaseActivity {

private static final int MESSAGE_ID_RECONNECTING = 0x01;

Expand All @@ -29,18 +28,19 @@ public class PLVideoTextureActivity extends AppCompatActivity {
private int mRotation = 0;
private int mDisplayAspectRatio = PLVideoTextureView.ASPECT_RATIO_FIT_PARENT; //default
private View mLoadingView;
private View mCoverView = null;
private boolean mIsActivityPaused = true;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_pl_video_texture);
mVideoView = (PLVideoTextureView) findViewById(R.id.VideoView);

mLoadingView = findViewById(R.id.LoadingView);
mVideoView.setBufferingIndicator(mLoadingView);
mLoadingView.setVisibility(View.VISIBLE);
mCoverView = (ImageView) findViewById(R.id.CoverView);
mVideoView.setCoverView(mCoverView);

mVideoPath = getIntent().getStringExtra("videoPath");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;

import com.pili.pldroid.player.AVOptions;
Expand All @@ -17,9 +16,9 @@
import com.pili.pldroid.playerdemo.widget.MediaController;

/**
* This is a demo activity of PLVideoView
* This is a demo activity of PLVideoView
*/
public class PLVideoViewActivity extends AppCompatActivity {
public class PLVideoViewActivity extends VideoPlayerBaseActivity {

private static final String TAG = PLVideoViewActivity.class.getSimpleName();

Expand All @@ -32,14 +31,16 @@ public class PLVideoViewActivity extends AppCompatActivity {
private int mDisplayAspectRatio = PLVideoView.ASPECT_RATIO_FIT_PARENT;
private boolean mIsActivityPaused = true;
private View mLoadingView;
private View mCoverView = null;

@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pl_video_view);
mVideoView = (PLVideoView) findViewById(R.id.VideoView);

mCoverView = (ImageView) findViewById(R.id.CoverView);
mVideoView.setCoverView(mCoverView);
mLoadingView = findViewById(R.id.LoadingView);
mVideoView.setBufferingIndicator(mLoadingView);
mLoadingView.setVisibility(View.VISIBLE);
Expand Down Expand Up @@ -78,7 +79,7 @@ protected void onCreate(Bundle savedInstanceState) {
mVideoView.setVideoPath(mVideoPath);

// You can also use a custom `MediaController` widget
mMediaController = new MediaController(this, false, isLiveStreaming==1);
mMediaController = new MediaController(this, false, isLiveStreaming == 1);
mVideoView.setMediaController(mMediaController);
}

Expand Down Expand Up @@ -214,7 +215,7 @@ public void onBufferingUpdate(PLMediaPlayer plMediaPlayer, int precent) {
@Override
public void onSeekComplete(PLMediaPlayer plMediaPlayer) {
Log.d(TAG, "onSeekComplete !");
};
}
};

private PLMediaPlayer.OnVideoSizeChangedListener mOnVideoSizeChangedListener = new PLMediaPlayer.OnVideoSizeChangedListener() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.pili.pldroid.playerdemo;

import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.WindowManager;

/**
* Created by kongweile on 29/10/2016.
* Auto hide and show navigation bar and status bar for API >= 19.
* Keep screen on.
*/

public class VideoPlayerBaseActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
Expand All @@ -28,7 +27,7 @@
* This is a demo activity of com.pili.pldroid.player.widget.VideoView
* @deprecated Use {@link PLVideoView} instead.
*/
public class VideoViewActivity extends AppCompatActivity implements
public class VideoViewActivity extends VideoPlayerBaseActivity implements
IjkMediaPlayer.OnCompletionListener,
IjkMediaPlayer.OnInfoListener,
IjkMediaPlayer.OnErrorListener,
Expand Down Expand Up @@ -58,7 +57,6 @@ public class VideoViewActivity extends AppCompatActivity implements
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_video_view);

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 36 additions & 28 deletions PLDroidPlayerDemo/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,118 +2,126 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:orientation="vertical">

<TextView
android:id="@+id/version_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:textSize="20sp"
android:textStyle="bold" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pls_choose_activity"
android:layout_margin="15dp"
android:text="@string/pls_choose_activity"
android:textSize="20sp"
android:textStyle="bold" />

<Spinner
android:id="@+id/TestSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"/>
android:layout_marginLeft="10dp" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pls_choose_setting"
android:layout_margin="15dp"
android:text="@string/pls_choose_setting"
android:textSize="20sp"
android:textStyle="bold" />

<RadioGroup
android:id="@+id/StreamingTypeRadioGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="15dp"
android:layout_marginTop="5dp" >
android:layout_marginTop="5dp"
android:orientation="horizontal">

<RadioButton
android:id="@+id/RadioLiveStreaming"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/live_streaming"
android:checked="true" />
android:checked="true"
android:text="@string/live_streaming" />

<RadioButton
android:id="@+id/RadioPlayback"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/playback"
android:layout_marginLeft="10dp" />
android:layout_marginLeft="10dp"
android:text="@string/playback" />

</RadioGroup>

<RadioGroup
android:id="@+id/DecodeTypeRadioGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="15dp"
android:layout_marginTop="5dp" >
android:layout_marginTop="5dp"
android:orientation="horizontal">

<RadioButton
android:id="@+id/RadioSWDecode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sw_decode"
android:checked="true" />
android:checked="true"
android:text="@string/sw_decode" />

<RadioButton
android:id="@+id/RadioHWDecode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hw_decode"
android:layout_marginLeft="10dp" />
android:layout_marginLeft="10dp"
android:text="@string/hw_decode" />

</RadioGroup>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pls_choose_videopath"
android:layout_marginTop="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="15dp"
android:text="@string/pls_choose_videopath"
android:textSize="20sp"
android:textStyle="bold" />

<EditText
android:id="@+id/VideoPathEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="@string/input_video_path"
android:singleLine="true"
android:textSize="18sp"
android:padding="10sp"
android:layout_margin="10dp" />
android:singleLine="true"
android:textSize="18sp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_margin="10dp" >
android:layout_margin="10dp"
android:orientation="horizontal">

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClickLocalFile"
android:text="@string/btn_local_file"
android:textSize="12sp"
android:onClick="onClickLocalFile" />
android:textSize="12sp" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/btn_click_play"
android:textSize="12sp"
android:layout_marginLeft="10dp"
android:onClick="onClickPlay"
android:layout_marginLeft="10dp" />
android:text="@string/btn_click_play"
android:textSize="12sp" />

</LinearLayout>

Expand Down
Loading

0 comments on commit 41ef7b9

Please sign in to comment.