Commit f430b483a5ae19e0bfcc143449ba8e5751180676
1 parent
934d5f6b
升级播放SDK
Showing
15 changed files
with
27 additions
and
29 deletions
.idea/gradle.xml
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | <GradleProjectSettings> | 5 | <GradleProjectSettings> |
| 6 | <option name="distributionType" value="LOCAL" /> | 6 | <option name="distributionType" value="LOCAL" /> |
| 7 | <option name="externalProjectPath" value="$PROJECT_DIR$" /> | 7 | <option name="externalProjectPath" value="$PROJECT_DIR$" /> |
| 8 | - <option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1" /> | 8 | + <option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-3.3" /> |
| 9 | <option name="modules"> | 9 | <option name="modules"> |
| 10 | <set> | 10 | <set> |
| 11 | <option value="$PROJECT_DIR$" /> | 11 | <option value="$PROJECT_DIR$" /> |
.idea/misc.xml
| @@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
| 37 | <ConfirmationsSetting value="0" id="Add" /> | 37 | <ConfirmationsSetting value="0" id="Add" /> |
| 38 | <ConfirmationsSetting value="0" id="Remove" /> | 38 | <ConfirmationsSetting value="0" id="Remove" /> |
| 39 | </component> | 39 | </component> |
| 40 | - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | 40 | + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
| 41 | <output url="file://$PROJECT_DIR$/build/classes" /> | 41 | <output url="file://$PROJECT_DIR$/build/classes" /> |
| 42 | </component> | 42 | </component> |
| 43 | <component name="ProjectType"> | 43 | <component name="ProjectType"> |
app/build.gradle
| @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' | @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' | ||
| 2 | 2 | ||
| 3 | android { | 3 | android { |
| 4 | compileSdkVersion 24 | 4 | compileSdkVersion 24 |
| 5 | - buildToolsVersion "24.0.3" | 5 | + buildToolsVersion '25.0.0' |
| 6 | defaultConfig { | 6 | defaultConfig { |
| 7 | applicationId "com.cnlive.demo.videoqn" | 7 | applicationId "com.cnlive.demo.videoqn" |
| 8 | minSdkVersion 16 | 8 | minSdkVersion 16 |
app/libs/libcnliveutilplus.jar
No preview for this file type
app/libs/libcnlivevideo.jar
No preview for this file type
app/src/main/java/com/cnlive/demo/videoqn/CNMediaPlayerActivity.java
| @@ -24,7 +24,7 @@ import com.cnlive.libs.lib_cnvideo.player.MediaPlayer; | @@ -24,7 +24,7 @@ import com.cnlive.libs.lib_cnvideo.player.MediaPlayer; | ||
| 24 | import java.io.IOException; | 24 | import java.io.IOException; |
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | - * This demo shows how to use IMediaPlayer API playing video stream | 27 | + * This demo shows how to use IMediaPlayer API playing video stream |
| 28 | */ | 28 | */ |
| 29 | public class CNMediaPlayerActivity extends VideoPlayerBaseActivity { | 29 | public class CNMediaPlayerActivity extends VideoPlayerBaseActivity { |
| 30 | 30 | ||
| @@ -37,7 +37,7 @@ public class CNMediaPlayerActivity extends VideoPlayerBaseActivity { | @@ -37,7 +37,7 @@ public class CNMediaPlayerActivity extends VideoPlayerBaseActivity { | ||
| 37 | private View mLoadingView; | 37 | private View mLoadingView; |
| 38 | private AVOptions mAVOptions; | 38 | private AVOptions mAVOptions; |
| 39 | 39 | ||
| 40 | - private int mSurfaceWidth = 0; | 40 | + private int mSurfaceWidth = 0; |
| 41 | private int mSurfaceHeight = 0; | 41 | private int mSurfaceHeight = 0; |
| 42 | 42 | ||
| 43 | private String mVideoPath = null; | 43 | private String mVideoPath = null; |
| @@ -190,8 +190,7 @@ public class CNMediaPlayerActivity extends VideoPlayerBaseActivity { | @@ -190,8 +190,7 @@ public class CNMediaPlayerActivity extends VideoPlayerBaseActivity { | ||
| 190 | e.printStackTrace(); | 190 | e.printStackTrace(); |
| 191 | } catch (IllegalStateException e) { | 191 | } catch (IllegalStateException e) { |
| 192 | e.printStackTrace(); | 192 | e.printStackTrace(); |
| 193 | - } | ||
| 194 | - catch (IOException e) { | 193 | + } catch (IOException e) { |
| 195 | e.printStackTrace(); | 194 | e.printStackTrace(); |
| 196 | } | 195 | } |
| 197 | } | 196 | } |
| @@ -217,15 +216,15 @@ public class CNMediaPlayerActivity extends VideoPlayerBaseActivity { | @@ -217,15 +216,15 @@ public class CNMediaPlayerActivity extends VideoPlayerBaseActivity { | ||
| 217 | }; | 216 | }; |
| 218 | 217 | ||
| 219 | private IMediaPlayer.OnVideoSizeChangedListener mOnVideoSizeChangedListener = new IMediaPlayer.OnVideoSizeChangedListener() { | 218 | private IMediaPlayer.OnVideoSizeChangedListener mOnVideoSizeChangedListener = new IMediaPlayer.OnVideoSizeChangedListener() { |
| 220 | - public void onVideoSizeChanged(IMediaPlayer mp, int width, int height) { | ||
| 221 | - Log.i(TAG, "onVideoSizeChanged, width = "+ width + ",height = " + height); | 219 | + public void onVideoSizeChanged(IMediaPlayer mp, int width, int height, int i, int i2) { |
| 220 | + Log.i(TAG, "onVideoSizeChanged, width = " + width + ",height = " + height); | ||
| 222 | // resize the display window to fit the screen | 221 | // resize the display window to fit the screen |
| 223 | if (width != 0 && height != 0) { | 222 | if (width != 0 && height != 0) { |
| 224 | - float ratioW = (float) width/(float) mSurfaceWidth; | ||
| 225 | - float ratioH = (float) height/(float) mSurfaceHeight; | 223 | + float ratioW = (float) width / (float) mSurfaceWidth; |
| 224 | + float ratioH = (float) height / (float) mSurfaceHeight; | ||
| 226 | float ratio = Math.max(ratioW, ratioH); | 225 | float ratio = Math.max(ratioW, ratioH); |
| 227 | - width = (int) Math.ceil((float)width/ratio); | ||
| 228 | - height = (int) Math.ceil((float)height/ratio); | 226 | + width = (int) Math.ceil((float) width / ratio); |
| 227 | + height = (int) Math.ceil((float) height / ratio); | ||
| 229 | FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(width, height); | 228 | FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(width, height); |
| 230 | layout.gravity = Gravity.CENTER; | 229 | layout.gravity = Gravity.CENTER; |
| 231 | mSurfaceView.setLayoutParams(layout); | 230 | mSurfaceView.setLayoutParams(layout); |
| @@ -269,13 +268,12 @@ public class CNMediaPlayerActivity extends VideoPlayerBaseActivity { | @@ -269,13 +268,12 @@ public class CNMediaPlayerActivity extends VideoPlayerBaseActivity { | ||
| 269 | }; | 268 | }; |
| 270 | 269 | ||
| 271 | /** | 270 | /** |
| 272 | - * Listen the event of playing complete | ||
| 273 | - * For playing local file, it's called when reading the file EOF | ||
| 274 | - * For playing network stream, it's called when the buffered bytes played over | ||
| 275 | - * | ||
| 276 | - * If setLooping(true) is called, the player will restart automatically | ||
| 277 | - * And `onCompletion` will not be called | ||
| 278 | - * | 271 | + * Listen the event of playing complete |
| 272 | + * For playing local file, it's called when reading the file EOF | ||
| 273 | + * For playing network stream, it's called when the buffered bytes played over | ||
| 274 | + * <p> | ||
| 275 | + * If setLooping(true) is called, the player will restart automatically | ||
| 276 | + * And `onCompletion` will not be called | ||
| 279 | */ | 277 | */ |
| 280 | private IMediaPlayer.OnCompletionListener mOnCompletionListener = new IMediaPlayer.OnCompletionListener() { | 278 | private IMediaPlayer.OnCompletionListener mOnCompletionListener = new IMediaPlayer.OnCompletionListener() { |
| 281 | @Override | 279 | @Override |
app/src/main/java/com/cnlive/demo/videoqn/CNVideoViewActivity.java
| @@ -86,10 +86,10 @@ public class CNVideoViewActivity extends VideoPlayerBaseActivity { | @@ -86,10 +86,10 @@ public class CNVideoViewActivity extends VideoPlayerBaseActivity { | ||
| 86 | mVideoView.setOnPreparedListener(onPreparedListener); | 86 | mVideoView.setOnPreparedListener(onPreparedListener); |
| 87 | 87 | ||
| 88 | //播放普通视频 | 88 | //播放普通视频 |
| 89 | - mVideoView.setVideoPath(mVideoPath); | 89 | +// mVideoView.setVideoPath(mVideoPath); |
| 90 | 90 | ||
| 91 | // //播放视讯云视频 | 91 | // //播放视讯云视频 |
| 92 | -// mVideoView.setDataSource(new ProgramLive(), false); | 92 | + mVideoView.setDataSource(new ProgramLive(), false); |
| 93 | 93 | ||
| 94 | // You can also use a custom `MediaController` widget | 94 | // You can also use a custom `MediaController` widget |
| 95 | mMediaController = new MediaController(this, false, isLiveStreaming == 1); | 95 | mMediaController = new MediaController(this, false, isLiveStreaming == 1); |
| @@ -240,8 +240,8 @@ public class CNVideoViewActivity extends VideoPlayerBaseActivity { | @@ -240,8 +240,8 @@ public class CNVideoViewActivity extends VideoPlayerBaseActivity { | ||
| 240 | 240 | ||
| 241 | private IMediaPlayer.OnVideoSizeChangedListener mOnVideoSizeChangedListener = new IMediaPlayer.OnVideoSizeChangedListener() { | 241 | private IMediaPlayer.OnVideoSizeChangedListener mOnVideoSizeChangedListener = new IMediaPlayer.OnVideoSizeChangedListener() { |
| 242 | @Override | 242 | @Override |
| 243 | - public void onVideoSizeChanged(IMediaPlayer plMediaPlayer, int width, int height) { | ||
| 244 | - Log.d(TAG, "onVideoSizeChanged: " + width + "," + height); | 243 | + public void onVideoSizeChanged(IMediaPlayer iMediaPlayer, int i, int i1, int i2, int i3) { |
| 244 | + Log.d(TAG, "onVideoSizeChanged: " + i + "," + i1 + "," + i2 + "," + i3); | ||
| 245 | } | 245 | } |
| 246 | }; | 246 | }; |
| 247 | 247 |
app/src/main/java/com/cnlive/demo/videoqn/VideoViewActivity.java
| @@ -253,7 +253,7 @@ public class VideoViewActivity extends VideoPlayerBaseActivity implements | @@ -253,7 +253,7 @@ public class VideoViewActivity extends VideoPlayerBaseActivity implements | ||
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | @Override | 255 | @Override |
| 256 | - public void onVideoSizeChanged(IMediaPlayer iMediaPlayer, int width, int height) { | 256 | + public void onVideoSizeChanged(IMediaPlayer iMediaPlayer, int width, int height, int i1, int i2) { |
| 257 | 257 | ||
| 258 | Log.i(TAG, "onVideoSizeChanged " + iMediaPlayer.getVideoWidth() + "x" + iMediaPlayer.getVideoHeight() + ",width:" + width + ",height:" + height); | 258 | Log.i(TAG, "onVideoSizeChanged " + iMediaPlayer.getVideoWidth() + "x" + iMediaPlayer.getVideoHeight() + ",width:" + width + ",height:" + height); |
| 259 | 259 |
app/src/main/java/com/cnlive/demo/videoqn/model/ProgramLive.java
| @@ -13,7 +13,7 @@ public class ProgramLive implements IDataSource{ | @@ -13,7 +13,7 @@ public class ProgramLive implements IDataSource{ | ||
| 13 | //返回直播视频ID | 13 | //返回直播视频ID |
| 14 | @Override | 14 | @Override |
| 15 | public String getId() { | 15 | public String getId() { |
| 16 | - return "news"; | 16 | + return "qwert"; |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | //返回视频类型 live | 19 | //返回视频类型 live |
app/src/main/jniLibs/arm64-v8a/libpldroidplayer.so
No preview for this file type
app/src/main/jniLibs/armeabi-v7a/libpldroidplayer.so
No preview for this file type
app/src/main/jniLibs/armeabi/libpldroidplayer.so
No preview for this file type
app/src/main/jniLibs/x86/libpldroidplayer.so
No preview for this file type
build.gradle
| @@ -5,7 +5,7 @@ buildscript { | @@ -5,7 +5,7 @@ buildscript { | ||
| 5 | jcenter() | 5 | jcenter() |
| 6 | } | 6 | } |
| 7 | dependencies { | 7 | dependencies { |
| 8 | - classpath 'com.android.tools.build:gradle:2.2.2' | 8 | + classpath 'com.android.tools.build:gradle:2.3.0' |
| 9 | 9 | ||
| 10 | // NOTE: Do not place your application dependencies here; they belong | 10 | // NOTE: Do not place your application dependencies here; they belong |
| 11 | // in the individual module build.gradle files | 11 | // in the individual module build.gradle files |
gradle/wrapper/gradle-wrapper.properties
| 1 | -#Mon Dec 28 10:00:20 PST 2015 | 1 | +#Thu Apr 06 18:31:12 CST 2017 |
| 2 | distributionBase=GRADLE_USER_HOME | 2 | distributionBase=GRADLE_USER_HOME |
| 3 | distributionPath=wrapper/dists | 3 | distributionPath=wrapper/dists |
| 4 | zipStoreBase=GRADLE_USER_HOME | 4 | zipStoreBase=GRADLE_USER_HOME |
| 5 | zipStorePath=wrapper/dists | 5 | zipStorePath=wrapper/dists |
| 6 | -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip | 6 | +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip |