load Video Source
Loads a video source for playback.
Initiates playback of a media file specified by the URI, with optional configuration, rendering to the SurfaceView provided at construction.
Example usage:
SurfaceView surfaceView = findViewById(R.id.surface_view);
SandboxedPlayer player = new SandboxedPlayer(context, surfaceView);
Bundle config = new Bundle();
config.putBoolean("loop_on_end", true);
player.loadVideoSource("http://example.com/video.mp4", config);
Content copied to clipboard
Parameters
uri
The media URI (e.g., "http://example.com/video.mp4").
config
Optional configuration, or null. Supported keys include:
- "mute_when_open" (
boolean, optional): Controls audio muting behavior during channel zapping. Iftrue, audio is muted until the first frame is rendered; iffalse, audio plays immediately. Default:true. Example:config.putBoolean("mute_when_open", false) - "encryption_type" (
String, optional): Specifies the encryption type for DRM-protected content. Valid values are:"com.widevine.alpha": Widevine DRM."com.microsoft.playready": PlayReady DRM.
- "encrypting_server" (
String, optional): URL of the encrypting server for DRM license requests. Required ifencryption_typeis set to a DRM type. - "encrypting_request_header" (
Object, optional): Additional headers for DRM license requests, typically aMap<String, String>or similar object. Format depends on the player implementation. - "drm_session_type" (
String, optional): Specifies the DRM session type. Set to"persistent"to persist the license and keys (requires server support, e.g., Widevine). Default: Non-persistent session if not specified. - "loop_on_end" (
boolean, optional): Controls whether the video replays upon reaching the end. Iftrue, the video loops; iffalse, it stops. Default:false.