Skip to content

Instantly share code, notes, and snippets.

View michael-riha's full-sized avatar
🎯
Focusing

Michael Riha michael-riha

🎯
Focusing
View GitHub Profile
// 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;
//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
<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>
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");
}