This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static final String TAG = "DeviceTypeRuntimeCheck"; | |
UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE); | |
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { | |
Log.d(TAG, "Running on a TV Device"); | |
} else { | |
Log.d(TAG, "Running on a non-TV Device"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<application | |
android:banner="@drawable/banner" > | |
... | |
<activity | |
android:name="com.example.android.MainActivity" | |
android:label="@string/app_name" > | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN" /> | |
<category android:name="android.intent.category.LAUNCHER" /> | |
</intent-filter> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//snippet from: https://github.com/bitmovin/bitmovin-player-android-samples/blob/5f0719f954e4ce8faee1bb290bed715a7ae1b935/BasicPlaybackTV/src/main/java/com/bitmovin/samples/tv/playback/basic/MainActivity.java#L64-L68 | |
playerConfiguration.getStyleConfiguration().setPlayerUiJs("file:///android_asset/bitmovinplayer-ui.js"); | |
// JS File can be found -> https://github.com/bitmovin/bitmovin-player-android-samples/tree/5f0719f954e4ce8faee1bb290bed715a7ae1b935/BasicPlaybackTV/src/main/assets |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/bitmovin/bitmovin-player-android-samples/blob/5f0719f954e4ce8faee1bb290bed715a7ae1b935/BasicPlaybackTV/src/main/java/com/bitmovin/samples/tv/playback/basic/MainActivity.java#L116-L130 | |
@Override | |
public boolean dispatchKeyEvent(KeyEvent event) | |
{ | |
// This method is called on key down and key up, so avoid being called twice | |
if (this.bitmovinPlayerView != null && event.getAction() == KeyEvent.ACTION_DOWN) | |
{ | |
if (this.handleUserInput(event.getKeyCode())) | |
{ | |
return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://github.com/bitmovin/bitmovin-player-android-samples/blob/5f0719f954e4ce8faee1bb290bed715a7ae1b935/BasicPlaybackTV/src/main/java/com/bitmovin/samples/tv/playback/basic/MainActivity.java#L134-L167 | |
private boolean handleUserInput(int keycode) | |
{ | |
Log.d(TAG, "Keycode " + keycode); | |
switch (keycode) | |
{ | |
case KeyEvent.KEYCODE_DPAD_CENTER: | |
case KeyEvent.KEYCODE_ENTER: | |
case KeyEvent.KEYCODE_NUMPAD_ENTER: | |
case KeyEvent.KEYCODE_SPACE: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/bitmovin/bitmovin-player-android-samples/blob/5f0719f954e4ce8faee1bb290bed715a7ae1b935/BasicPlaybackTV/src/main/java/com/bitmovin/samples/tv/playback/basic/MainActivity.java#L177 | |
this.bitmovinPlayer.play(); | |
// https://github.com/bitmovin/bitmovin-player-android-samples/blob/5f0719f954e4ce8faee1bb290bed715a7ae1b935/BasicPlaybackTV/src/main/java/com/bitmovin/samples/tv/playback/basic/MainActivity.java#L173 | |
this.bitmovinPlayer.pause(); | |
// https://github.com/bitmovin/bitmovin-player-android-samples/blob/5f0719f954e4ce8faee1bb290bed715a7ae1b935/BasicPlaybackTV/src/main/java/com/bitmovin/samples/tv/playback/basic/MainActivity.java#L181-L185 | |
private void stopPlayback() | |
{ | |
this.bitmovinPlayer.pause(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// paste this inside: https://github.com/bitmovin/bitmovin-player-android-samples/blob/5f0719f954e4ce8faee1bb290bed715a7ae1b935/BasicPlaybackTV/src/main/java/com/bitmovin/samples/tv/playback/basic/MainActivity.java#L69 | |
// Do this to get a good startup quality. try to start with a rendition around 12Mbit in this case | |
playerConfiguration.getAdaptationConfiguration().setStartupBitrate(12_000_000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
import com.bitmovin.analytics.BitmovinAnalyticsConfig; | |
import com.bitmovin.analytics.bitmovin.player.BitmovinPlayerCollector; | |
import com.bitmovin.analytics.enums.CDNProvider; | |
... | |
//Step 1: Create your analytics config object | |
BitmovinAnalyticsConfig bitmovinAnalyticsConfig = new BitmovinAnalyticsConfig("<ANALYTICS_KEY>", "<PLAYER_KEY>", getApplicationContext()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected String gePlayerLicenseKey() { | |
// https://blog.iangclifton.com/2010/10/08/using-meta-data-in-an-androidmanifest/ | |
try { | |
ApplicationInfo ai = getPackageManager().getApplicationInfo(this.getPackageName(), PackageManager.GET_META_DATA); | |
Bundle bundle = ai.metaData; | |
String playerApiKey = bundle.getString("BITMOVIN_PLAYER_LICENSE_KEY"); | |
return playerApiKey; | |
} catch (PackageManager.NameNotFoundException e) { | |
Log.e(TAG, "Failed to load meta-data, NameNotFound: " + e.getMessage()); | |
} catch (NullPointerException e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//get this key directly from the AndroidManifest.xml | |
String playerKey= this.gePlayerLicenseKey(); | |
//Step 1: Create your analytics config object | |
BitmovinAnalyticsConfig bitmovinAnalyticsConfig = new BitmovinAnalyticsConfig("<ANALYTICS_KEY>", playerKey, getApplicationContext()); | |
//Step 2: Add optional parameters -> https://gist.github.com/michael-riha/85c5d9629dfc38be9d4c5ad9aaf02a4f | |
//Step 3: Create Analytics Collector -> https://gist.github.com/michael-riha/85c5d9629dfc38be9d4c5ad9aaf02a4f | |
... | |
//Step 4: Attach BitmovinPlayer final step |
OlderNewer