Kaltura Player is a rich, easy to integrate and easy to use video player for all media types and ad scenarios you need. - based on Google ExoPlayer
Kaltura Player - This Playkit
wrapper simplifies the player integration so that client applications will require less boilerplate code, which ensures a faster integration.
Gradle Dependency: implementation 'com.kaltura.player:tvplayer:4.x.x'
+ add mavenCentral() in repositories section
This dependency already includes Playkit, Kava Analytics Player Providers and Download-to-Go libraries internally, so no need to add them to the client app's build.gradle
.
Kaltura Player Migration Guide
Kaltura Player Basic Player Samples
Kaltura Player Advanced Samples
Client application should call a mandatory initialization method calls at the time of application Launch or in the project's Application
class file or the SplashActivity
.
KalturaPlayer.initializeOTT(this, OTT_PARNTER_ID, OTT_SERVER_URL);
KalturaPlayer.initializeOVP(this, OVP_PARNTER_ID, OVP_SERVER_URL);
public static final String OTT_SERVER_URL = "https://rest-us.ott.kaltura.com/v4_5/";
public static final int OTT_PARNTER_ID = 3009;
Without calling the initialization code on startup KalturaPlayerNotInitializedError
, error will be fired on the player.loadMedia
callback phase.
Application can use the warmup connections for its specific CDN
servers URLs where the medias are hosted so a connection to the hosts will be opened and ready for use so all handshake process will be saved and media playback will be faster.
There should be only one URL per host, and the URLs should resolve to a valid path names. A good choice might be favicon.ico
or crossdomain.xml
after the host name.
If application wants to use connection warmer mechanism then this call will be placed at the time of application Launch or in the project's Application
class file.
/*
Set the http provider. Valid options are "system" (use the build-in {@linkplain java.net.HttpURLConnection})
and "okhttp" (use Square's <a href="https://square.github.io/okhttp/">OkHttp</a> library).
*/
PKHttpClientManager.setHttpProvider("okhttp");
PKHttpClientManager.warmUp (
"https://https://rest-us.ott.kaltura.com/crossdomain.xml",
"http://cdnapi.kaltura.com/favicon.ico",
"https://cdnapisec.kaltura.com/favicon.ico",
"https://cfvod.kaltura.com/favicon.ico"
);
Please check the samples for Media Providers here
Application should create PlayerInitOptions
.
For initialization of OTT Player use OTT_PARTNER_ID
and for initialization if OVP player useOVP_PARTNER_ID
val mediaOptions = buildMediaOptions()
player?.loadMedia(mediaOptions) { entry, loadError ->
if (loadError != null) {
Snackbar.make(findViewById(android.R.id.content), loadError.message, Snackbar.LENGTH_LONG).show()
} else {
log.d("onEntryLoadComplete entry = " + entry.id)
}
}
OR
fun loadPlaykitPlayer(pkMediaEntry: PKMediaEntry) {
val playerInitOptions = PlayerInitOptions()
player = KalturaBasicPlayer.create(this@MainActivity, playerInitOptions)
player?.setPlayerView(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)
val container = player_root
container.addView(player?.playerView)
player?.setMedia(pkMediaEntry, START_POSITION)
}
Notes
In playerInitOptions
the default value for player autoplay is true.
In playerInitOptions
the default value for player media preload from the BE is true.