I’m trying to create a live stream entry for which I need to pass the Kaltura session.
I found a sample code in the below link (click on the Test console tab. And select the livestream service from the dropdown. click on Java and click show code example). And was trying to follow along. But the Kaltura version (18.0.1) I use doesn’t support this style.
Maven dependency used:
<dependency> <groupId>com.kaltura</groupId> <artifactId>kalturaApiClient</artifactId> <version>18.0.1</version> </dependency>
Is anyone aware of how to pass the Kaltura session to the service class in java? Appreciate your help!
Setting up the java configuration:
Configuration config = new Configuration();
config.setEndpoint(“https://www.kaltura.com/“);
Client client = new Client(config);
Generating the kaltura session using Java:
String session = client.generateSessionV2(“some admin secret", “some email id",
SessionType.ADMIN , partnerId, expiry, “some privileges”);
Trying to create a live stream entry using java:
LiveStreamEntry liveStreamEntry = new LiveStreamEntry();
liveStreamEntry.setName(“Webcast Tutorial”);
liveStreamEntry.setDescription(“This is a test webcast”);
liveStreamEntry.setMediaType(com.kaltura.client.enums.MediaType.LIVE_STREAM_FLASH);
liveStreamEntry.setDvrStatus(DVRStatus.ENABLED);
liveStreamEntry.setDvrWindow(60);
liveStreamEntry.setSourceType(SourceType.LIVE_STREAM);
liveStreamEntry.setAdminTags(“kms-webcast-event,vpaas-webcast”);
liveStreamEntry.setPushPublishEnabled(LivePublishStatus.DISABLED);
liveStreamEntry.setExplicitLive(Boolean.TRUE);
liveStreamEntry.setRecordStatus(RecordStatus.PER_SESSION);
LiveStreamService.AddLiveStreamBuilder result = LiveStreamService.add(liveStreamEntry, SourceType.LIVE_STREAM);
Here is the sample code from Python way of doing the same:
Generating ks token from python
def client_for_admin(username, privileges):
kaltura_config = KalturaConfiguration(“partner id")
kaltura_config.serviceUrl = “https://www.kaltura.com/”
client = KalturaClient(kaltura_config)
ks = client.session.start(
“admin secret",
username,
KalturaSessionType.ADMIN,
“partner id",
“expiry",
privileges)
client.setKs(ks)
return client
client = ks.client_for_admin(config.admin_email, “”)
Generating live stream using python
live_stream_entry = KalturaLiveStreamEntry()
live_stream_entry.name = “Webcast Tutorial”
live_stream_entry.description = “This is a test webcast”
live_stream_entry.mediaType = KalturaMediaType.LIVE_STREAM_FLASH
live_stream_entry.dvrStatus = KalturaDVRStatus.ENABLED
live_stream_entry.dvrWindow = 60
live_stream_entry.sourceType = KalturaSourceType.LIVE_STREAM
live_stream_entry.adminTags = “kms-webcast-event,vpaas-webcast”
live_stream_entry.pushPublishEnabled = KalturaLivePublishStatus.DISABLED
live_stream_entry.explicitLive = KalturaNullableBoolean.TRUE_VALUE
live_stream_entry.recordStatus = KalturaRecordStatus.PER_SESSION
result = client.liveStream.add(live_stream_entry, KalturaSourceType.LIVE_STREAM); // livestream is called from the client which has the kaltura session.