streamPropertyChanged not working in android

I am implementing mute/unmute audio and enable/disable video features in android, though they are working fine in react and angular JS but for some reason, not on android.
so here is what I did. first, I muted/unmuted audio in the local audio track and then emitted the following socket event to notify other participants about the action

session.getLocalParticipant().getAudioTrack().setEnabled(status);
JSONObject paramsJson = new JSONObject();
paramsJson.put(“streamId”, session.getLocalParticipant().getStreamId());
paramsJson.put(“property”, “audioActive”);
paramsJson.put(“newValue”, String.valueOf(status));
paramsJson.put(“reason”, “publishAudio”);

JSONObject jsonObject = new JSONObject();
jsonObject.put(“jsonrpc”, JsonConstants.JSON_RPCVERSION);
jsonObject.put(“method”, method);
jsonObject.put(“id”, id);
jsonObject.put(“params”, paramsJson);
this.websocket.sendText(jsonObject.toString());

Though audio did get muted/unmuted but for some reason, other participants who joined the session from React, Angular, and android samples didn’t receive it. The same is happening on video enable/disable.

If you are refering to the openvidu-android tutorial, then you are right: streamPropertyChanged event won’t work.

openvidu-android tutorial implements just the minimum subset of RPC methods available for clients in the openvidu-browser JS client. This is the full list of RPC methods of OpenVidu Server RPC protocol: OpenVidu Server RPC protocol - OpenVidu Docs.

openvidu-android only implements a few of them: openvidu-tutorials/CustomWebSocket.java at master · OpenVidu/openvidu-tutorials · GitHub, the minimum necessary for having simple video conferences.

Ok, Let me explain it again -
Let’s assume -
User A joined the conference from react sample and user B joined it from the android sample. When user A mutes/unmutes himself user B receives “streamPropertyChanged” event. but if user B who is on android mutes/unmutes himself, I am sending this “streamPropertyChanged” event using the above-mentioned code but user A is not receiving the callback

Hi Irfan92,

have you found a solution for this problem? I am facing the exactly the same error.

As pabloFuente said - reacting on incoming streamPropertyChanged event on android side is missing in openvidu-android sample. But in my view the event should fire on browser-clients if we change something on our android stream - because it is just an incoming websocket event?
Or do I completely misunderstand the RPC protocol?

No. I am still waiting for the answer.

If the JSON RPC call is being properly sent from the Android side, and a new server event hadler is added (openvidu-tutorials/CustomWebSocket.java at master · OpenVidu/openvidu-tutorials · GitHub), then the streamPropertyChanged event should be fired on every session participant.

There is no technical limitation to add this event, if it is being sent and received correctly (like the rest of the events that are actually implemented in the app).

@pabloFuente

My misunderstanding was, that I thought that the “streamPropertyChanged” Event is an event, that is only fired by OpenVidu server if the server detects a changed stream property. If I know, that I have to fire this event to the websocket on my own, I did it and it works!

@Irfan92

Your sample looks quite good (maybe a missing connectionId parameter?). I am doing nearly the same and the streamPropertyChanged event from Android is fired in my browser application. Did you check the OpenVidu server logs? In my case, I used a wrong streamId and I detected an error in this logs.

Here is my sample (shortened version):

// enable video
session?.localParticipant?.videoTrack?.setEnabled(true)

// generate json params
val params = JSONObject().apply {
    put("connectionId", session?.localParticipant?.connectionId)
    put("streamId", session?.streamId)
    put("property", "videoActive")
    put("newValue", true)
    put("reason", "publishVideo")
}

// generate complete json
val jsonObject = JSONObject()
jsonObject.put("jsonrpc", JsonConstants.JSON_RPCVERSION)
jsonObject.put("method", method)
jsonObject.put("id", id)
jsonObject.put("params", params)

// send to websocket
webSocket?.sendText(jsonObject.toString())