Some progress

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2017-11-15 15:59:42 +01:00
parent ef714afe68
commit eb9d7ec0d7
4 changed files with 12 additions and 8 deletions

View File

@ -632,7 +632,7 @@ public class CallActivity extends AppCompatActivity {
} }
@Subscribe(threadMode = ThreadMode.BACKGROUND) @Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onMessageEvent(SessionDescriptionSendEvent sessionDescriptionSend) { public void onMessageEvent(SessionDescriptionSendEvent sessionDescriptionSend) throws IOException {
Log.d("MARIO_123", "SENDING " + sessionDescriptionSend.getType()); Log.d("MARIO_123", "SENDING " + sessionDescriptionSend.getType());
String credentials = ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken()); String credentials = ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken());
NCMessageWrapper ncMessageWrapper = new NCMessageWrapper(); NCMessageWrapper ncMessageWrapper = new NCMessageWrapper();
@ -656,8 +656,13 @@ public class CallActivity extends AppCompatActivity {
ncSignalingMessage.setPayload(ncMessagePayload); ncSignalingMessage.setPayload(ncMessagePayload);
ncMessageWrapper.setSignalingMessage(ncSignalingMessage); ncMessageWrapper.setSignalingMessage(ncSignalingMessage);
List<NCMessageWrapper> ncMessageWrappers = new ArrayList<>();
ncMessageWrappers.add(ncMessageWrapper);
Log.d("MARIO_123", LoganSquare.serialize(ncMessageWrappers));
ncApi.sendSignalingMessages(credentials, ApiHelper.getUrlForSignaling(userEntity.getBaseUrl()), ncApi.sendSignalingMessages(credentials, ApiHelper.getUrlForSignaling(userEntity.getBaseUrl()),
ncMessageWrapper) ncMessageWrappers)
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.newThread())
.subscribe(new Observer<Integer>() { .subscribe(new Observer<Integer>() {
@Override @Override

View File

@ -33,6 +33,7 @@ import com.nextcloud.talk.api.models.json.signaling.NCMessageWrapper;
import com.nextcloud.talk.api.models.json.signaling.SignalingOverall; import com.nextcloud.talk.api.models.json.signaling.SignalingOverall;
import com.nextcloud.talk.api.models.json.userprofile.UserProfileOverall; import com.nextcloud.talk.api.models.json.userprofile.UserProfileOverall;
import java.util.List;
import java.util.Map; import java.util.Map;
import io.reactivex.Observable; import io.reactivex.Observable;
@ -168,7 +169,7 @@ public interface NcApi {
*/ */
@POST @POST
Observable<Integer> sendSignalingMessages(@Header("Authorization") String authorization, @Url String url, Observable<Integer> sendSignalingMessages(@Header("Authorization") String authorization, @Url String url,
@Body NCMessageWrapper ncMessageWrapper); @Body List<NCMessageWrapper> ncMessageWrapper);
/* /*
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /signaling Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /signaling

View File

@ -36,7 +36,4 @@ public class NCIceCandidate {
@JsonField(name = "candidate") @JsonField(name = "candidate")
String candidate; String candidate;
@JsonField(name = "type")
String type;
} }

View File

@ -90,6 +90,9 @@ public class PeerConnectionWrapper {
@Override @Override
public void onIceGatheringChange(PeerConnection.IceGatheringState iceGatheringState) { public void onIceGatheringChange(PeerConnection.IceGatheringState iceGatheringState) {
if (iceGatheringState.equals(PeerConnection.IceGatheringState.COMPLETE)) {
sendLocalCandidates();
}
} }
@Override @Override
@ -150,7 +153,6 @@ public class PeerConnectionWrapper {
// We've just set our local SDP so time to send it, drain // We've just set our local SDP so time to send it, drain
// remote and send local ICE candidates. // remote and send local ICE candidates.
Log.d("MARIO", "SENDING ANSWER FROM OBSERVER"); Log.d("MARIO", "SENDING ANSWER FROM OBSERVER");
sendLocalCandidates();
EventBus.getDefault().post(new SessionDescriptionSendEvent(peerConnection.getLocalDescription EventBus.getDefault().post(new SessionDescriptionSendEvent(peerConnection.getLocalDescription
(), (),
sessionId, sessionId,
@ -162,7 +164,6 @@ public class PeerConnectionWrapper {
public void onCreateSuccess(SessionDescription sessionDescription) { public void onCreateSuccess(SessionDescription sessionDescription) {
super.onCreateSuccess(sessionDescription); super.onCreateSuccess(sessionDescription);
peerConnection.setLocalDescription(magicSdpObserver, sessionDescription); peerConnection.setLocalDescription(magicSdpObserver, sessionDescription);
sendLocalCandidates();
} }
}, mediaConstraints); }, mediaConstraints);