package com.castlabs.sdk.downloads;

import androidx.multidex.MultiDexApplication;

import com.castlabs.android.PlayerSDK;
import com.castlabs.android.drm.SharedPreferencesKeyStore;
import com.castlabs.sdk.downloader.DownloaderPlugin;
import com.castlabs.sdk.subtitles.SubtitlesPlugin;
import com.castlabs.sdk.thumbs.ThumbsPlugin;


public class DownloadsApp extends MultiDexApplication {

	@Override
	public void onCreate() {
		super.onCreate();

		// Setup the castlabs SDK and register the plugins used
		// by this demo.

		// We use the SharedPreferencesKeyStore to persist keySetIds in the Applications
		// shared preferences.
		PlayerSDK.DEFAULT_KEY_STORE = new SharedPreferencesKeyStore(this);

		// (Optional) Register the extended subtitles plugin
		PlayerSDK.register(new SubtitlesPlugin());

		// (Optional) Register the Thumbnail plugin
		PlayerSDK.register(new ThumbsPlugin(true));

		// Downloader plugin
		PlayerSDK.register(new DownloaderPlugin(new NotificationProvider(), 10, DownloaderPlugin.STORAGE_LOW_MODE_QUEUED));

		// Initialize the SDK with all registered plugins
		PlayerSDK.init(getApplicationContext());
	}
}
