Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d2b7b38
feat: add VideoTrackInfo class
Doominika Feb 4, 2026
5237e90
feat: add StreamTrackModification class
Doominika Feb 4, 2026
b7107fd
feat: add StreamUpdatedEventData class
Doominika Feb 4, 2026
0014c4b
feat: add UpdatedStreamData class
Doominika Feb 4, 2026
3c1588e
feat: add StreamRoomDeletedEventData class
Doominika Feb 4, 2026
79a6692
fix: add StreamRoomDeletedEventData class
Doominika Feb 4, 2026
d67ca31
feat: add StreamPublishedEventData class
Doominika Feb 4, 2026
366c681
feat: add StreamEventData class
Doominika Feb 4, 2026
e311fe0
feat: add StreamUnpublishedEventData class
Doominika Feb 4, 2026
1eabb47
feat: add NewStreams class
Doominika Feb 4, 2026
fc2c394
feat: add StreamsUpdatedData class
Doominika Feb 4, 2026
85d1c07
feat: update StreamPublishResult class
Doominika Feb 4, 2026
556833b
feat: add parse streams event function
Doominika Feb 4, 2026
9d2de70
feat: add initEvent function to header
Doominika Feb 4, 2026
61a45d0
refactor: rename StreamPublishedEventData
Doominika Feb 4, 2026
c5bedd1
feat: add buildSubscriptionQuery to StreamApiLow
Doominika Feb 4, 2026
30f71a1
feat: add class for handling parsing functions used by EventQueue
Doominika Feb 4, 2026
f82213c
refactor: move stream events to core events and remove EventsList class
Doominika Feb 6, 2026
d0b3405
refactor: add missing type to StreamEventType
Doominika Feb 9, 2026
4acf01c
chore: change removeVideoTrack
Doominika Feb 9, 2026
9026e42
feat: add missing methods
Doominika Feb 9, 2026
492800a
chore: cleaning
Doominika Feb 9, 2026
fd80927
chore: delete privmx-endpoint-streams-android
Doominika Feb 9, 2026
1c752e8
Merge remote-tracking branch 'origin/android-stream-api-testing' into…
Doominika Feb 9, 2026
56aab8f
Merge remote-tracking branch 'origin/android-stream-api-testing' into…
Doominika Feb 9, 2026
0f844af
refactor: move streams low to privmx-endpoint
Doominika Feb 9, 2026
a5d8d85
feat: add stream events to endpoint java extra
Doominika Feb 10, 2026
e9c7010
refactor: remove stream event types from base endpoint and put them i…
Doominika Feb 10, 2026
a7288ab
feat: update streamApiLow constructor
Doominika Feb 10, 2026
2fb3526
feat: make streamApiLow initializing function in PrivmxEndpoint
Doominika Feb 19, 2026
e9818e2
Merge remote-tracking branch 'origin/android-stream-api-testing' into…
Doominika Feb 19, 2026
2cb9856
Merge remote-tracking branch 'origin/android-stream-api-testing' into…
Doominika Feb 19, 2026
2edaffa
feat: move streams like on branch
Doominika Feb 20, 2026
8aaf063
fix: errors related with moving streamApiLow
Doominika Feb 20, 2026
b8122e0
feat: throw exception if eventApi is null when initializing streamApiLow
Doominika Feb 20, 2026
b9a5dc2
chore: correct the naming errors
Doominika Feb 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 17 additions & 61 deletions jni-wrappers/privmx-endpoint/src/cpp/modules/StreamApiLow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,77 +26,33 @@ StreamApiLow *getStreamApi(JniContextUtils &ctx, jobject streamApiInstance) {
return (stream::StreamApiLow *) ctx.getObject(apiLong).getLongValue();
}

//extern "C"
//JNIEXPORT jobject JNICALL
//Java_com_simplito_java_privmx_1endpoint_modules_stream_StreamApiLow_init(
// JNIEnv *env,
// jobject thiz,
// jobject connection,
// jobject eventApi
//) {
// JniContextUtils ctx(env);
// jobject result;
//
// if (ctx.nullCheck(connection, "Connection") ||
// ctx.nullCheck(eventApi, "EventApi")) {
// return nullptr;
// }
//
//// ctx.callResultEndpointApi<jobject>(&result, [&ctx, &env, &thiz, &connection, &eventApi] {
// auto connection_c = getConnection(env, connection);
// auto eventApi_c = getEventApi(ctx, eventApi);
// auto streamApiLow = stream::StreamApiLow::create(
// *connection_c,
// *eventApi_c
// );
// auto streamApiLow_ptr = new stream::StreamApiLow();
// *streamApiLow_ptr = streamApiLow;
// return ctx.long2jLong((jlong) streamApiLow_ptr);
//// });
// if (ctx->ExceptionCheck()) {
// return nullptr;
// }
// return result;
//}

extern "C"
JNIEXPORT jobject JNICALL
Java_com_simplito_java_privmx_1endpoint_modules_stream_StreamApiLow_create(
Java_com_simplito_java_privmx_1endpoint_modules_stream_StreamApiLow_init(
JNIEnv *env,
jclass clazz,
jobject thiz,
jobject connection,
jobject eventApi
) {
JniContextUtils ctx(env);
if (ctx.nullCheck(connection, "Connection")) {
return nullptr;
}

// jobject result;
// ctx.callResultEndpointApi<jobject>(&result, [&ctx, &env, &clazz, &connection, &eventApi] {
jmethodID initMID = ctx->GetMethodID(clazz, "<init>",
"(Ljava/lang/Long;)V");
auto connection_c = getConnection(env, connection);
auto eventApi_c = getEventApi(env, eventApi);
auto streamApiLow = StreamApiLow::create(
*connection_c,
*eventApi_c
);
auto *api = new StreamApiLow();
*api = streamApiLow;

jobject result = ctx->NewObject(
clazz,
initMID,
ctx.long2jLong((jlong) api)
);
return result;
jobject result;

// });
if (ctx->ExceptionCheck()) {
if (ctx.nullCheck(connection, "Connection") ||
ctx.nullCheck(eventApi, "EventApi")) {
return nullptr;
}
return result;

ctx.callResultEndpointApi<jobject>(&result, [&ctx, &env, &connection, &eventApi] {
auto connection_c = getConnection(env, connection);
auto eventApi_c = getEventApi(env, eventApi);
auto streamApiLow = stream::StreamApiLow::create(
*connection_c,
*eventApi_c
);
auto streamApiLow_ptr = new stream::StreamApiLow();
*streamApiLow_ptr = streamApiLow;
return ctx.long2jLong((jlong) streamApiLow_ptr);
});
}

extern "C"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,13 @@ public enum SubscriptionModule {
*/
KVDB,
/**
* CoreModules
* Core module case.
*/
CORE
CORE,
/**
* Stream module case.
*/
STREAM
}

private static class Pair {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@
import com.simplito.java.privmx_endpoint.model.events.eventTypes.KvdbEventType;
import com.simplito.java.privmx_endpoint.model.events.eventTypes.StoreEventType;
import com.simplito.java.privmx_endpoint.model.events.eventTypes.ThreadEventType;
import com.simplito.java.privmx_endpoint.streams.model.StreamRoom;
import com.simplito.java.privmx_endpoint.streams.model.events.NewStreams;
import com.simplito.java.privmx_endpoint.streams.model.events.StreamEventData;
import com.simplito.java.privmx_endpoint.streams.model.events.StreamPublishedEventData;
import com.simplito.java.privmx_endpoint.streams.model.events.StreamRoomDeletedEventData;
import com.simplito.java.privmx_endpoint.streams.model.events.StreamUnpublishedEventData;
import com.simplito.java.privmx_endpoint.streams.model.events.StreamUpdatedEventData;
import com.simplito.java.privmx_endpoint.streams.model.events.StreamsUpdatedData;
import com.simplito.java.privmx_endpoint.streams.model.events.eventSelectorTypes.StreamEventSelectorType;
import com.simplito.java.privmx_endpoint.streams.model.events.eventTypes.StreamEventType;

import java.util.Objects;

Expand Down Expand Up @@ -715,4 +725,103 @@ public static EventType<ContextUsersStatusChangedEventData> ContextUsersStatusCh
);
}

public static EventType<StreamRoom> StreamRoomCreatedEvent(String contextId) {
return new EventType<>(
"streamRoomCreated",
StreamEventType.STREAMROOM_CREATE,
StreamEventSelectorType.CONTEXT_ID,
contextId,
StreamRoom.class
);
}

public static EventType<StreamRoom> StreamRoomUpdatedEvent(StreamEventSelectorType selectorType, String selectorId) {
return new EventType<>(
"streamRoomUpdated",
StreamEventType.STREAMROOM_UPDATE,
selectorType,
selectorId,
StreamRoom.class
);
}

public static EventType<StreamRoomDeletedEventData> StreamRoomDeletedEvent(StreamEventSelectorType selectorType, String selectorId) {
return new EventType<>(
"streamRoomDeleted",
StreamEventType.STREAMROOM_DELETE,
StreamEventSelectorType.CONTEXT_ID,
selectorId,
StreamRoomDeletedEventData.class
);
}

public static EventType<StreamPublishedEventData> StreamPublishedEvent(StreamEventSelectorType selectorType, String selectorId) {
return new EventType<>(
"streamPublished",
StreamEventType.STREAM_PUBLISH,
selectorType,
selectorId,
StreamPublishedEventData.class
);
}

public static EventType<StreamUpdatedEventData> StreamUpdatedEvent(StreamEventSelectorType selectorType, String selectorId) {
return new EventType<>(
"streamUpdated",
StreamEventType.STREAMROOM_UPDATE,
selectorType,
selectorId,
StreamUpdatedEventData.class
);
}

public static EventType<StreamEventData> StreamJoinedEvent(StreamEventSelectorType selectorType, String selectorId) {
return new EventType<>(
"streamJoined",
StreamEventType.STREAM_JOIN,
selectorType,
selectorId,
StreamEventData.class
);
}

public static EventType<StreamUnpublishedEventData> StreamUnpublishedEvent(StreamEventSelectorType selectorType, String selectorId) {
return new EventType<>(
"streamUnpublished",
StreamEventType.STREAM_UNPUBLISH,
selectorType,
selectorId,
StreamUnpublishedEventData.class
);
}

public static EventType<StreamEventData> StreamLeftEvent(StreamEventSelectorType selectorType, String selectorId) {
return new EventType<>(
"streamLeft",
StreamEventType.STREAM_LEAVE,
selectorType,
selectorId,
StreamEventData.class
);
}

public static EventType<NewStreams> StreamNewStreamsEvent(StreamEventSelectorType selectorType, String selectorId) {
return new EventType<>(
"StreamNewStreams",
StreamEventType.STREAMROOM_UPDATE,
selectorType,
selectorId,
NewStreams.class
);
}

public static EventType<StreamsUpdatedData> StreamsUpdatedEvent(StreamEventSelectorType selectorType, String selectorId) {
return new EventType<>(
"streamsUpdated",
StreamEventType.STREAMROOM_UPDATE,
selectorType,
selectorId,
StreamsUpdatedData.class
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.simplito.java.privmx_endpoint.modules.inbox.InboxApi;
import com.simplito.java.privmx_endpoint.modules.kvdb.KvdbApi;
import com.simplito.java.privmx_endpoint.modules.store.StoreApi;
import com.simplito.java.privmx_endpoint.modules.stream.StreamApiLow;
import com.simplito.java.privmx_endpoint.modules.thread.ThreadApi;
import com.simplito.java.privmx_endpoint_extra.model.Modules;

Expand Down Expand Up @@ -62,6 +63,10 @@ public class BasicPrivmxEndpoint implements AutoCloseable {
*/
public final Connection connection;

/**
* Reference to STREAM module.
*/
protected StreamApiLow streamApiLow;

/**
* Initializes modules and connects to PrivMX Bridge server using given parameters.
Expand Down Expand Up @@ -120,6 +125,17 @@ public BasicPrivmxEndpoint(
this(enableModule, userPrivateKey, solutionId, bridgeUrl, null);
}

public StreamApiLow initializeStreamApiLow() throws IllegalStateException, PrivmxException {
if (streamApiLow == null) {
if (eventApi == null) throw new IllegalStateException("eventApi is not initialized.");

streamApiLow = new StreamApiLow(connection, eventApi);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if event api is not initialized then this method should throw exception

return streamApiLow;
}

return streamApiLow;
}

/**
* Disconnects from PrivMX Bridge and frees memory.
*
Expand All @@ -133,5 +149,6 @@ public void close() throws Exception {
if (eventApi != null) eventApi.close();
if (kvdbApi != null) kvdbApi.close();
if (connection != null) connection.close();
if (streamApiLow != null) streamApiLow.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import com.simplito.java.privmx_endpoint.model.events.eventTypes.ThreadEventType;
import com.simplito.java.privmx_endpoint.model.exceptions.NativeException;
import com.simplito.java.privmx_endpoint.model.exceptions.PrivmxException;
import com.simplito.java.privmx_endpoint.model.stream.events.eventSelectorTypes.StreamEventSelectorType;
import com.simplito.java.privmx_endpoint.model.stream.events.eventTypes.StreamEventType;
import com.simplito.java.privmx_endpoint.modules.crypto.CryptoApi;
import com.simplito.java.privmx_endpoint_extra.events.CallbackRegistration;
import com.simplito.java.privmx_endpoint_extra.events.EventCallback;
Expand Down Expand Up @@ -212,6 +214,17 @@ public List<RegistrationResult> registerManyCallbacks(
(CoreEventSelectorType) eventType.eventSelectorType,
eventType.eventSelectorId
);
} else if (eventType.libEventType instanceof StreamEventType) {
if (streamApiLow != null) {
module = EventDispatcher.SubscriptionModule.STREAM;
query = streamApiLow.buildSubscriptionQuery(
(StreamEventType) eventType.libEventType,
(StreamEventSelectorType) eventType.eventSelectorType,
eventType.eventSelectorId
);
} else {
throw new IllegalStateException("streamApiLow is not initialized. Try to initialize it first by calling the initializeStreamApiLow method.");
}
}
EventsToSubscribe eventsToSubscribe = eventsToSubscribeByModule.getOrDefault(
module,
Expand Down Expand Up @@ -256,6 +269,11 @@ private void unsubscribeMany(EventDispatcher.SubscriptionModule module, List<Str
throw new IllegalStateException("Connection is not initialized");
connection.unsubscribeFrom(subscriptionIds);
break;
case STREAM:
if (streamApiLow == null)
throw new IllegalStateException("streamApiLow is not initialized");
streamApiLow.unsubscribeFrom(subscriptionIds);
break;
}
}

Expand Down Expand Up @@ -315,6 +333,12 @@ private void subscribeAll(Map<EventDispatcher.SubscriptionModule, EventsToSubscr
}
subscribeFor(value.queriesMap, connection::subscribeFor);
break;
case STREAM:
if (streamApiLow == null) {
throw new IllegalStateException("streamApiLow is not initialized");
}
subscribeFor(value.queriesMap, streamApiLow::subscribeFor);
break;
}
} catch (IllegalStateException | NativeException | PrivmxException e) {
List<EventToSubscribe> callbacks = value.queriesMap.values().stream().flatMap(Collection::stream).collect(Collectors.toList());
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// PrivMX Endpoint Java.
// Copyright © 2024 Simplito sp. z o.o.
//
// This file is part of the PrivMX Platform (https://privmx.dev).
// This software is Licensed under the MIT License.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//

package com.simplito.java.privmx_endpoint.model.stream;

public class Key {
public String keyId;
public byte[] key;
public KeyType type;

public Key(
String keyId,
byte[] key,
KeyType type
) {
this.keyId = keyId;
this.key = key;
this.type = type;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// PrivMX Endpoint Java.
// Copyright © 2024 Simplito sp. z o.o.
//
// This file is part of the PrivMX Platform (https://privmx.dev).
// This software is Licensed under the MIT License.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//

package com.simplito.java.privmx_endpoint.model.stream;

public enum KeyType {
LOCAL,
REMOTE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.simplito.java.privmx_endpoint.model.stream;

public class PublishedStreamData {
public String streamRoomId;
public StreamInfo stream;
public String userId;

public PublishedStreamData(String streamRoomId, StreamInfo stream, String userId) {
this.streamRoomId = streamRoomId;
this.stream = stream;
this.userId = userId;
}
}
Loading