Skip to content

Commit a2829b2

Browse files
CopilotCarGuo
andcommitted
Remove test functionality while keeping core SurfaceControl implementation
Co-authored-by: CarGuo <[email protected]>
1 parent e282bc9 commit a2829b2

File tree

3 files changed

+0
-100
lines changed

3 files changed

+0
-100
lines changed

app/src/main/java/com/example/gsyvideoplayer/exo/DetailExoListPlayer.java

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import android.view.View;
88
import android.widget.ImageView;
99
import android.widget.RelativeLayout;
10-
import android.os.Build;
11-
import android.util.Log;
1210

1311
import com.example.gsyvideoplayer.R;
1412
import com.example.gsyvideoplayer.databinding.ActivityDeatilExoListPlayerBinding;
@@ -88,54 +86,8 @@ public void onClick(View v) {
8886
}
8987
});
9088

91-
// Demo: Test SurfaceControl functionality when using SurfaceView
92-
testSurfaceControlDemo();
93-
94-
}
95-
96-
/**
97-
* Demonstration of SurfaceControl functionality for reparenting surfaces
98-
* This method shows how to access SurfaceControl when using SurfaceView render type
99-
*/
100-
private void testSurfaceControlDemo() {
101-
Log.i("DetailExoListPlayer", "Testing SurfaceControl functionality...");
102-
103-
// Test if SurfaceControl is supported on this API level
104-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
105-
Log.i("DetailExoListPlayer", "SurfaceControl is supported on API " + Build.VERSION.SDK_INT);
106-
107-
// Test with the current player view (delayed to ensure initialization)
108-
binding.detailPlayer.postDelayed(new Runnable() {
109-
@Override
110-
public void run() {
111-
// Test the player view functionality directly
112-
GSYExo2PlayerView currentPlayer = (GSYExo2PlayerView) binding.detailPlayer.getCurrentPlayer();
113-
if (currentPlayer != null) {
114-
boolean hasSupport = currentPlayer.testSurfaceControlSupport();
115-
Log.i("DetailExoListPlayer", "SurfaceControl support test result: " + hasSupport);
116-
117-
// Test getting SurfaceControl directly
118-
try {
119-
Object surfaceControl = currentPlayer.getSurfaceControl();
120-
if (surfaceControl != null) {
121-
Log.i("DetailExoListPlayer", "SurfaceControl obtained successfully for reparenting operations");
122-
} else {
123-
Log.w("DetailExoListPlayer", "SurfaceControl is null - may need SurfaceView render type or surface not ready");
124-
}
125-
} catch (Exception e) {
126-
Log.w("DetailExoListPlayer", "Error getting SurfaceControl: " + e.getMessage());
127-
}
128-
} else {
129-
Log.w("DetailExoListPlayer", "Current player is null");
130-
}
131-
}
132-
}, 2000); // Delay to ensure surface is ready
133-
} else {
134-
Log.w("DetailExoListPlayer", "SurfaceControl not supported on API " + Build.VERSION.SDK_INT + " (requires API 29+)");
135-
}
13689
}
13790

138-
13991
/**
14092
* 重载为GSYExoVideoManager的方法处理
14193
*/

app/src/main/java/com/example/gsyvideoplayer/exo/GSYExo2PlayerView.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -384,29 +384,4 @@ public SurfaceControl getSurfaceControl() {
384384
}
385385
return null;
386386
}
387-
388-
/**
389-
* Test method to verify SurfaceControl functionality
390-
* This demonstrates how to access and use SurfaceControl for reparenting
391-
*
392-
* @return true if SurfaceControl is available and working, false otherwise
393-
*/
394-
public boolean testSurfaceControlSupport() {
395-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
396-
if (GSYVideoType.getRenderType() == GSYVideoType.SUFRACE) {
397-
SurfaceControl surfaceControl = getSurfaceControl();
398-
if (surfaceControl != null) {
399-
android.util.Log.i("GSYExo2PlayerView", "SurfaceControl available for reparenting operations");
400-
return true;
401-
} else {
402-
android.util.Log.w("GSYExo2PlayerView", "SurfaceControl not available - surface may not be ready");
403-
}
404-
} else {
405-
android.util.Log.i("GSYExo2PlayerView", "SurfaceControl requires GSYVideoType.SUFRACE render type");
406-
}
407-
} else {
408-
android.util.Log.w("GSYExo2PlayerView", "SurfaceControl requires API 29+, current API: " + Build.VERSION.SDK_INT);
409-
}
410-
return false;
411-
}
412387
}

app/src/main/java/com/example/gsyvideoplayer/exo/GSYExoPlayerManager.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -320,31 +320,4 @@ public void reparentSurface(Object playerView, SurfaceControl newParent) {
320320
public boolean isSurfaceControlSupported() {
321321
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
322322
}
323-
324-
/**
325-
* Test method to demonstrate SurfaceControl reparenting functionality
326-
* This shows how to use SurfaceControl for switching surfaces
327-
*
328-
* @param playerView the GSYExo2PlayerView instance
329-
* @return true if reparenting operations are supported, false otherwise
330-
*/
331-
public boolean testSurfaceControlReparenting(Object playerView) {
332-
if (!isSurfaceControlSupported()) {
333-
android.util.Log.w("GSYExoPlayerManager", "SurfaceControl not supported on API " + Build.VERSION.SDK_INT);
334-
return false;
335-
}
336-
337-
if (playerView instanceof com.example.gsyvideoplayer.exo.GSYExo2PlayerView) {
338-
com.example.gsyvideoplayer.exo.GSYExo2PlayerView exoPlayerView =
339-
(com.example.gsyvideoplayer.exo.GSYExo2PlayerView) playerView;
340-
341-
boolean hasSupport = exoPlayerView.testSurfaceControlSupport();
342-
if (hasSupport) {
343-
android.util.Log.i("GSYExoPlayerManager", "SurfaceControl reparenting functionality is available");
344-
// Additional reparenting test could be added here
345-
return true;
346-
}
347-
}
348-
return false;
349-
}
350323
}

0 commit comments

Comments
 (0)