Here are the examples of the java api com.kaltura.playkit.Player.play() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
15
Source : MainActivity.java
with GNU Affero General Public License v3.0
from kaltura
with GNU Affero General Public License v3.0
from kaltura
private void playItem(String itemId, PKMediaSource mediaSource, PKMediaEntry.MediaEntryType type) {
PKMediaEntry entry = new PKMediaEntry().setId(itemId).setMediaType(type).setSources(Collections.singletonList(mediaSource));
setupPlayer();
player.prepare(new PKMediaConfig().setMediaEntry(entry));
player.play();
}
8
Source : MainActivity.java
with GNU Affero General Public License v3.0
from kaltura
with GNU Affero General Public License v3.0
from kaltura
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
}
ProviderInstaller.installIfNeededAsync(this, new ProviderInstaller.ProviderInstallListener() {
@Override
public void onProviderInstalled() {
}
@Override
public void onProviderInstallFailed(int i, Intent intent) {
Toast.makeText(context, "ProviderInstallFailed", Toast.LENGTH_LONG).show();
}
});
itemArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1);
loadTesreplacedems(itemArrayAdapter);
if (!isNetworkAvailable()) {
toast("NO NETWORK AVAILABLE");
}
contentManager = ContentManager.getInstance(this);
contentManager.getSettings().defaultHlsAudioBitrateEstimation = DemoParams.defaultHlsAudioBitrateEstimation;
contentManager.getSettings().applicationName = "MyApplication";
contentManager.getSettings().maxConcurrentDownloads = 4;
contentManager.getSettings().createNoMediaFileInDownloadsDir = true;
contentManager.getSettings().crossProtocolRedirectEnabled = true;
contentManager.addDownloadStateListener(cmListener);
try {
contentManager.start(() -> {
for (DownloadItem item : contentManager.getDownloads(DownloadState.values())) {
itemStateChanged(item);
}
setListAdapter(itemArrayAdapter);
});
} catch (IOException e) {
e.printStackTrace();
toast("Failed to get ContentManager");
return;
}
localreplacedetsManager = new LocalreplacedetsManager(context);
// localreplacedetsManager.forceWidevineL3Playback(true);
findViewById(R.id.download_control).setOnClickListener(v -> {
String[] actions = { "Start service", "Stop service" };
new AlertDialog.Builder(MainActivity.this).setreplacedle("Download Action").sereplacedems(actions, (dialog, which) -> {
switch(which) {
case 0:
try {
contentManager.start(() -> toast("Service started"));
} catch (IOException e) {
e.printStackTrace();
}
break;
case 1:
contentManager.stop();
break;
}
}).show();
});
findViewById(R.id.player_control).setOnClickListener(v -> {
String[] actions = { "Play", "Pause", "Seek -60", "Seek -15", "Seek +15", "Seek +60", "Select audio", "Select text" };
new AlertDialog.Builder(MainActivity.this).setreplacedle("Player Action").sereplacedems(actions, (dialog, which) -> {
if (player == null) {
return;
}
switch(which) {
case 0:
player.play();
break;
case 1:
player.pause();
break;
case 2:
player.seekTo(player.getCurrentPosition() - 60000);
break;
case 3:
player.seekTo(player.getCurrentPosition() - 15000);
break;
case 4:
player.seekTo(player.getCurrentPosition() + 15000);
break;
case 5:
player.seekTo(player.getCurrentPosition() + 60000);
break;
case 6:
selectPlayerTrack(true);
break;
case 7:
selectPlayerTrack(false);
break;
}
}).show();
});
}