Sandboxed Player
This class handles video rendering on a SurfaceView and provides control over playback, audio, events, and readiness state.
Initializes the player with the provided Context and SurfaceView, setting up the necessary resources for rendering video output. The Context is used to access system services or resources, while the SurfaceView serves as the rendering surface for video playback.
Important for Integration Partners: The SurfaceView must be attached to the window (i.e., added to the view hierarchy and laid out) before the player can be considered fully ready, as indicated by getReady. Ensure the SurfaceView is part of your layout and has completed its attachment process before calling methods like loadVideoSource. Use setObserver or check getReady to confirm readiness.
Example usage:
SurfaceView surfaceView = findViewById(R.id.surface_view);
Player player = new SandboxedPlayer(context, surfaceView);
// Wait for SurfaceView attachment and player readiness
player.setObserver(activity, isReady -> {
if (isReady) {
player.loadVideoSource("http://example.com/video.mp4", null);
} else {
Log.d("Client", "Player not ready yet, waiting for SurfaceView attachment");
}
});