Playback of clear content
To test this feature and view the example code, please see the Android SDK 5 Example Code Quick Start guide.
The SDK is created and initialised when the client application starts up (upon calling OTVSDK.load()
) and is destroyed when the application terminates. Typically, the SDK is created by the following code within the application entry point activity onCreate()
method.
OTVSDK.load(this);
Player lifecycle
An OTVVideoView
object must be created and configured to enable users to watch any content.
The application follows instructions from the user to play content by providing the SDK with the URL.
If the streaming content is served over HTTPS, under certain circumstances you may need to disable SSL verification
The application instantiates an
OTVVideoView
(typically through the layout definitions), and the application passes the URL usingmOTVVideoView.setVideoPath(url)
.The player is destroyed when playback stops.
Changing streams
Streams can be changed by either:
Stopping playback, destroying the instance of the player and creating a new instance with a new URL.
Updating the existing instance of the player instructing it to use a different URL.
Stream type detection
When OtvVideoView#setVideoPath()
is called, the SDK can detect the stream type by:
Observing the filename extension in the path (for example,
.m3u8
for HLS,.manifest
for DASH)Sending an HTTP HEAD request and observing the returned
ContentType
value.
If neither of the methods can identify the stream type, playback will fail with an error. Alternatively, if the app can determine the content type from the stream metadata, it can inform the player explicitly by using mOTVVideoView.setVideoPath(String path, int contentType)
.