55import android .graphics .Color ;
66import android .net .Uri ;
77import android .os .Build .VERSION ;
8+ import android .text .TextUtils ;
89import android .util .TypedValue ;
910import android .view .Gravity ;
1011import android .view .LayoutInflater ;
1516import android .util .Pair ;
1617import com .google .android .exoplayer2 .C ;
1718import com .google .android .exoplayer2 .ExoPlaybackException ;
18- import com .google .android .exoplayer2 .ExoPlayerLibraryInfo ;
1919import com .google .android .exoplayer2 .Format ;
2020import com .google .android .exoplayer2 .PlaybackParameters ;
2121import com .google .android .exoplayer2 .Player ;
4242import com .liskovsoft .youtubeapi .common .helpers .AppClient ;
4343import com .liskovsoft .youtubeapi .service .internal .MediaServiceData ;
4444
45- import org .chromium .net .ApiVersion ;
46-
4745import java .util .ArrayList ;
4846import java .util .List ;
4947import java .util .Locale ;
@@ -207,8 +205,9 @@ private void updateAndPost() {
207205 appendDeviceNameSDKCache ();
208206 appendMemoryInfo ();
209207 appendWebViewInfo ();
210- appendClientType ();
211- appendPlayerVersion ();
208+ appendWebClientInfo ();
209+ //appendClientType();
210+ //appendPlayerVersion();
212211 appendAccountInfo ();
213212
214213 // Schedule next update
@@ -259,17 +258,22 @@ private void updateVideoInfo() {
259258 //mVideoInfo.add(new Pair<>("Aspect Ratio", par));
260259 String videoCodecName = getVideoDecoderNameV2 ();
261260 mVideoInfo .add (new Pair <>("Video decoder name" , videoCodecName ));
262- mVideoInfo .add (new Pair <>("Hardware accelerated" , String .valueOf (DeviceHelpers .isHardwareAccelerated (videoCodecName ))));
261+ // mVideoInfo.add(new Pair<>("Hardware accelerated", String.valueOf(DeviceHelpers.isHardwareAccelerated(videoCodecName))));
263262
264263 if (video .colorInfo != null ) {
264+ //String transferFunction = getColorTransferString(video.colorInfo.colorTransfer);
265+ //if (!transferFunction.equals(NOT_AVAILABLE)) {
266+ // mVideoInfo.add(new Pair<>("Transfer function", transferFunction));
267+ //}
268+ //String colorSpace = getColorSpaceString(video.colorInfo.colorSpace);
269+ //if (!colorSpace.equals(NOT_AVAILABLE)) {
270+ // mVideoInfo.add(new Pair<>("Color space", colorSpace));
271+ //}
272+
265273 String transferFunction = getColorTransferString (video .colorInfo .colorTransfer );
266- if (!transferFunction .equals (NOT_AVAILABLE )) {
267- mVideoInfo .add (new Pair <>("Transfer function" , transferFunction ));
268- }
269274 String colorSpace = getColorSpaceString (video .colorInfo .colorSpace );
270- if (!colorSpace .equals (NOT_AVAILABLE )) {
271- mVideoInfo .add (new Pair <>("Color space" , colorSpace ));
272- }
275+
276+ mVideoInfo .add (new Pair <>("Transfer function/Color space" , transferFunction + "/" + colorSpace ));
273277 }
274278 }
275279
@@ -284,7 +288,7 @@ private void appendRuntimeInfo() {
284288 }
285289
286290 private void appendPlayerState () {
287- appendRow ("Player paused" , !mPlayer .getPlayWhenReady ());
291+ // appendRow("Player paused", !mPlayer.getPlayWhenReady());
288292
289293 String text ;
290294 switch (mPlayer .getPlaybackState ()) {
@@ -304,7 +308,8 @@ private void appendPlayerState() {
304308 text = "unknown" ;
305309 break ;
306310 }
307- appendRow ("Playback state" , text );
311+ //appendRow("Playback state", text);
312+ appendRow ("Playback state" , String .format ("paused=%s;state=%s" , !mPlayer .getPlayWhenReady (), text ));
308313 }
309314
310315 private void appendDisplayModeId () {
@@ -329,8 +334,11 @@ private void updateDisplayModeId() {
329334 mDisplayModeId .add (new Pair <>("UI resolution" , currentResolution != null ? currentResolution : NOT_AVAILABLE ));
330335 mDisplayModeId .add (new Pair <>("Boot resolution" , bootResolution != null ? bootResolution : NOT_AVAILABLE ));
331336
332- mDisplayModeId .add (new Pair <>("Display mode ID" , currentMode != null ? String .valueOf (currentMode .getModeId ()) : NOT_AVAILABLE ));
333- mDisplayModeId .add (new Pair <>("Display modes length" , supportedModes != null ? String .valueOf (supportedModes .length ) : NOT_AVAILABLE ));
337+ //mDisplayModeId.add(new Pair<>("Display mode ID", currentMode != null ? String.valueOf(currentMode.getModeId()) : NOT_AVAILABLE));
338+ //mDisplayModeId.add(new Pair<>("Display modes length", supportedModes != null ? String.valueOf(supportedModes.length) : NOT_AVAILABLE));
339+ String modeId = currentMode != null ? String .valueOf (currentMode .getModeId ()) : NOT_AVAILABLE ;
340+ String modeLength = supportedModes != null ? String .valueOf (supportedModes .length ) : NOT_AVAILABLE ;
341+ mDisplayModeId .add (new Pair <>("Display mode ID/length" , modeId + "/" + modeLength ));
334342 }
335343
336344 private void appendDisplayInfo () {
@@ -350,28 +358,30 @@ private void appendPlayerWindowIndex() {
350358 }
351359
352360 private void appendVersion () {
353- appendRow ("ExoPlayer version" , ExoPlayerLibraryInfo .VERSION );
361+ // appendRow("ExoPlayer version", ExoPlayerLibraryInfo.VERSION);
354362 appendRow ("ExoPlayer engine" ,
355363 PlayerTweaksData .instance (mContext ).getPlayerDataSource () == PlayerTweaksData .PLAYER_DATA_SOURCE_OKHTTP ? "OkHttp" :
356364 PlayerTweaksData .instance (mContext ).getPlayerDataSource () == PlayerTweaksData .PLAYER_DATA_SOURCE_CRONET ? "Cronet" :
357365 "Default" );
358- appendRow ("Cronet version" , ApiVersion .getCronetVersion ());
366+ // appendRow("Cronet version", ApiVersion.getCronetVersion());
359367 //appendRow("OkHttp version", Version.userAgent());
360368 appendRow (mAppVersion , AppInfoHelpers .getAppVersionName (mContext ));
361369 }
362370
363371 private void appendDeviceNameSDKCache () {
364- appendRow ("Device name" , Helpers .getDeviceName ());
365- appendRow ("Android SDK" , VERSION .SDK_INT );
372+ //appendRow("Device name", Helpers.getDeviceName());
373+ //appendRow("Android SDK", VERSION.SDK_INT);
374+ appendRow ("Device name/SDK" , Helpers .getDeviceName () + "/" + VERSION .SDK_INT );
366375 appendRow ("Disk cache size (MB)" , String .valueOf (
367376 (FileHelpers .getDirSize (FileHelpers .getInternalCacheDir (mContext )) + FileHelpers .getDirSize (FileHelpers .getExternalCacheDir (mContext )))
368377 / 1024 / 1024
369378 ));
370379 }
371380
372381 private void appendMemoryInfo () {
373- appendRow ("Max heap memory (MB)" , DeviceHelpers .getMaxHeapMemoryMB ()); // Growth Limit
374- appendRow ("Allocated heap memory (MB)" , DeviceHelpers .getAllocatedHeapMemoryMB ());
382+ //appendRow("Max heap memory (MB)", DeviceHelpers.getMaxHeapMemoryMB()); // Growth Limit
383+ //appendRow("Allocated heap memory (MB)", DeviceHelpers.getAllocatedHeapMemoryMB());
384+ appendRow ("Allocated heap memory (MB)" , DeviceHelpers .getAllocatedHeapMemoryMB () + "/" + DeviceHelpers .getMaxHeapMemoryMB ());
375385 }
376386
377387 private void appendWebViewInfo () {
@@ -397,6 +407,13 @@ private void appendPlayerVersion() {
397407 }
398408 }
399409
410+ private void appendWebClientInfo () {
411+ String clientType = getClientType ();
412+ CharSequence playerVersion = getPlayerVersion ();
413+
414+ appendRow ("Web client/Web player version" , TextUtils .concat (clientType , "/" , playerVersion ));
415+ }
416+
400417 private void appendAccountInfo () {
401418 appendRow ("Account info" , MediaServiceManager .instance ().printAccountDebugInfo ());
402419 }
@@ -523,4 +540,24 @@ private String getColorSpaceString(int colorSpace) {
523540 return NOT_AVAILABLE ;
524541 }
525542 }
543+
544+ private String getClientType () {
545+ int videoInfoType = MediaServiceData .instance ().getVideoInfoType ();
546+ String clientType = videoInfoType != -1 && videoInfoType < AppClient .values ().length ? AppClient .values ()[videoInfoType ].name () : "default" ;
547+
548+ return clientType ;
549+ }
550+
551+ private CharSequence getPlayerVersion () {
552+ CharSequence result = NOT_AVAILABLE ;
553+ AppInfo appInfo = Helpers .firstNonNull (MediaServiceData .instance ().getFailedAppInfo (), MediaServiceData .instance ().getAppInfo ());
554+ String playerUrl = appInfo != null ? appInfo .getPlayerUrl () : null ;
555+ if (playerUrl != null ) {
556+ String playerVersion = UrlQueryStringFactory .parse (Uri .parse (playerUrl )).get ("player" );
557+ boolean isFailed = MediaServiceData .instance ().getFailedAppInfo () != null ;
558+ result = isFailed ? Utils .color (playerVersion , Color .RED ) : playerVersion ;
559+ }
560+
561+ return result ;
562+ }
526563}
0 commit comments