Skip to content

Commit 4210df6

Browse files
authored
Merge pull request #1230 from chenqian-dev/master
Release 2.2.0
2 parents 207d3eb + 8e2b696 commit 4210df6

24 files changed

Lines changed: 103 additions & 48 deletions

File tree

PLDroidPlayerDemo/app/build.gradle

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "com.pili.pldroid.playerdemo"
99
minSdkVersion 14
1010
targetSdkVersion 27
11-
versionCode 12
12-
versionName "2.1.9"
11+
versionCode 13
12+
versionName "2.2.0"
1313
buildConfigField "long", "BUILD_TIMESTAMP", System.currentTimeMillis() + "L"
1414
}
1515
buildTypes {
@@ -21,16 +21,27 @@ android {
2121

2222
sourceSets {
2323
main {
24-
jniLibs.srcDirs = ['src/main/jniLibs']
24+
if (!useLibrary) {
25+
jniLibs.srcDirs = ['src/main/jniLibs']
26+
}
2527
}
2628
}
2729
}
2830

2931
dependencies {
30-
implementation files('libs/pldroid-player-2.1.9.jar')
32+
33+
if (useLibrary) {
34+
implementation project(path: ':library')
35+
} else {
36+
implementation files('libs/pldroid-player-2.2.0.jar')
37+
}
38+
3139
implementation 'com.android.support:appcompat-v7:27.1.0'
3240
implementation 'com.android.support:recyclerview-v7:27.1.0'
3341
implementation 'com.journeyapps:zxing-android-embedded:3.0.2@aar'
3442
implementation 'com.google.zxing:core:3.2.0'
3543
implementation 'com.bugsnag:bugsnag-android-ndk:1.1.2'
44+
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.4'
45+
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4'
46+
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4'
3647
}
77.6 KB
Binary file not shown.

PLDroidPlayerDemo/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
1111
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
1212
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
13+
<uses-permission android:name="android.permission.CAMERA"/>
1314

1415
<supports-screens
1516
android:anyDensity="true"

PLDroidPlayerDemo/app/src/main/java/com/pili/pldroid/playerdemo/MainActivity.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ public boolean isPermissionOK() {
124124
}
125125

126126
public void onClickLocalFile(View v) {
127+
if(!isPermissionOK()){
128+
return;
129+
}
127130
Intent intent = new Intent();
128131
if (Build.VERSION.SDK_INT < 19) {
129132
intent.setAction(Intent.ACTION_GET_CONTENT);
@@ -137,6 +140,9 @@ public void onClickLocalFile(View v) {
137140
}
138141

139142
public void onClickScanQrcode(View v) {
143+
if(!isPermissionOK()){
144+
return;
145+
}
140146
IntentIntegrator integrator = new IntentIntegrator(this);
141147
integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES);
142148
integrator.setOrientationLocked(true);

PLDroidPlayerDemo/app/src/main/java/com/pili/pldroid/playerdemo/PLVideoViewActivity.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public void onVideoSizeChanged(int width, int height) {
261261
@Override
262262
public void onVideoFrameAvailable(byte[] data, int size, int width, int height, int format, long ts) {
263263
Log.i(TAG, "onVideoFrameAvailable: " + size + ", " + width + " x " + height + ", " + format + ", " + ts);
264-
if (format == PLOnVideoFrameListener.VIDEO_FORMAT_SEI && bytesToHex(Arrays.copyOfRange(data, 19, 23)).equals("74733634")) {
264+
if (format == PLOnVideoFrameListener.VIDEO_FORMAT_SEI && size > 0) {
265265
// If the RTMP stream is from Qiniu
266266
// Add &addtssei=true to the end of URL to enable SEI timestamp.
267267
// Format of the byte array:
@@ -272,7 +272,15 @@ public void onVideoFrameAvailable(byte[] data, int size, int width, int height,
272272
// 19-22: ts64 Magic string to mark this stream is from Qiniu
273273
// 23-30: timestamp The timestamp
274274
// 31: 0x80 Magic hex in ffmpeg
275-
Log.i(TAG, " timestamp: " + Long.valueOf(bytesToHex(Arrays.copyOfRange(data, 23, 31)), 16));
275+
int index = 2;
276+
int payloadSize = 0;
277+
do {
278+
payloadSize += data[index] & 0xFF;
279+
} while (data[index++] == (byte) 0xFF);
280+
String uuid = bytesToHex(Arrays.copyOfRange(data, index, index + 16));
281+
int length = payloadSize - 16;
282+
String content = new String(data, index + 16, length);
283+
Log.i(TAG, " SEI data size:" + data.length + " content: " + content + " length = " + length);
276284
}
277285
}
278286
};

PLDroidPlayerDemo/app/src/main/java/com/pili/pldroid/playerdemo/utils/PermissionChecker.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ public boolean checkPermission() {
5151
if (!addPermission(permissionsList, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
5252
permissionsNeeded.add("Write external storage");
5353
}
54+
if (!addPermission(permissionsList, Manifest.permission.CAMERA)) {
55+
permissionsNeeded.add("Camera");
56+
}
5457

5558
if (permissionsNeeded.size() > 0) {
5659
// Need Rationale
152 KB
Binary file not shown.
76.3 KB
Binary file not shown.
-2.61 MB
Binary file not shown.
-1.93 MB
Binary file not shown.

0 commit comments

Comments
 (0)