Search in sources :

Example 1 with ArrayListMediaTrack

use of im.actor.core.viewmodel.generics.ArrayListMediaTrack in project actor-platform by actorapp.

the class CallActor method onOwnTrackAdded.

@Override
public void onOwnTrackAdded(WebRTCMediaTrack track) {
    if (track.getTrackType() == WebRTCTrackType.AUDIO) {
        ArrayListMediaTrack tracks = new ArrayListMediaTrack(callVM.getOwnAudioTracks().get());
        tracks.add(track);
        callVM.getOwnAudioTracks().change(tracks);
    } else if (track.getTrackType() == WebRTCTrackType.VIDEO) {
        ArrayListMediaTrack tracks = new ArrayListMediaTrack(callVM.getOwnVideoTracks().get());
        tracks.add(track);
        callVM.getOwnVideoTracks().change(tracks);
    } else {
    // Unknown track type
    }
}
Also used : ArrayListMediaTrack(im.actor.core.viewmodel.generics.ArrayListMediaTrack)

Example 2 with ArrayListMediaTrack

use of im.actor.core.viewmodel.generics.ArrayListMediaTrack in project actor-platform by actorapp.

the class CallActor method onTrackAdded.

//
// Track Events
//
@Override
public void onTrackAdded(long deviceId, WebRTCMediaTrack track) {
    if (track.getTrackType() == WebRTCTrackType.AUDIO) {
        ArrayListMediaTrack tracks = new ArrayListMediaTrack(callVM.getTheirAudioTracks().get());
        tracks.add(track);
        callVM.getTheirAudioTracks().change(tracks);
    } else if (track.getTrackType() == WebRTCTrackType.VIDEO) {
        ArrayListMediaTrack tracks = new ArrayListMediaTrack(callVM.getTheirVideoTracks().get());
        tracks.add(track);
        callVM.getTheirVideoTracks().change(tracks);
    } else {
    // Unknown track type
    }
}
Also used : ArrayListMediaTrack(im.actor.core.viewmodel.generics.ArrayListMediaTrack)

Example 3 with ArrayListMediaTrack

use of im.actor.core.viewmodel.generics.ArrayListMediaTrack in project actor-platform by actorapp.

the class CallActor method onTrackRemoved.

@Override
public void onTrackRemoved(long deviceId, WebRTCMediaTrack track) {
    if (track.getTrackType() == WebRTCTrackType.AUDIO) {
        ArrayListMediaTrack tracks = new ArrayListMediaTrack(callVM.getTheirAudioTracks().get());
        tracks.remove(track);
        callVM.getTheirAudioTracks().change(tracks);
    } else if (track.getTrackType() == WebRTCTrackType.VIDEO) {
        ArrayListMediaTrack tracks = new ArrayListMediaTrack(callVM.getTheirVideoTracks().get());
        tracks.remove(track);
        callVM.getTheirVideoTracks().change(tracks);
    } else {
    // Unknown track type
    }
}
Also used : ArrayListMediaTrack(im.actor.core.viewmodel.generics.ArrayListMediaTrack)

Example 4 with ArrayListMediaTrack

use of im.actor.core.viewmodel.generics.ArrayListMediaTrack in project actor-platform by actorapp.

the class CallActor method onOwnTrackRemoved.

@Override
public void onOwnTrackRemoved(WebRTCMediaTrack track) {
    if (track.getTrackType() == WebRTCTrackType.AUDIO) {
        ArrayListMediaTrack tracks = new ArrayListMediaTrack(callVM.getOwnAudioTracks().get());
        tracks.remove(track);
        callVM.getOwnAudioTracks().change(tracks);
    } else if (track.getTrackType() == WebRTCTrackType.VIDEO) {
        ArrayListMediaTrack tracks = new ArrayListMediaTrack(callVM.getOwnVideoTracks().get());
        tracks.remove(track);
        callVM.getOwnVideoTracks().change(tracks);
    } else {
    // Unknown track type
    }
}
Also used : ArrayListMediaTrack(im.actor.core.viewmodel.generics.ArrayListMediaTrack)

Example 5 with ArrayListMediaTrack

use of im.actor.core.viewmodel.generics.ArrayListMediaTrack in project actor-platform by actorapp.

the class JsBindingModule method getCall.

public JsBindedValue<JsCall> getCall(String id) {
    if (!calls.containsKey(id)) {
        final CallVM callModel = messenger.getCall(Long.parseLong(id));
        final JsBindedValue<JsCall> jsCall = new JsBindedValue<>(JsCall.create(messenger, callModel));
        callModel.getState().subscribe(new ValueChangedListener<CallState>() {

            @Override
            public void onChanged(CallState val, Value<CallState> valueModel) {
                jsCall.changeValue(JsCall.create(messenger, callModel));
            }
        });
        callModel.getMembers().subscribe(new ValueChangedListener<ArrayList<CallMember>>() {

            @Override
            public void onChanged(ArrayList<CallMember> val, Value<ArrayList<CallMember>> valueModel) {
                jsCall.changeValue(JsCall.create(messenger, callModel));
            }
        });
        callModel.getOwnVideoTracks().subscribe(new ValueChangedListener<ArrayListMediaTrack>() {

            @Override
            public void onChanged(ArrayListMediaTrack val, Value<ArrayListMediaTrack> valueModel) {
                jsCall.changeValue(JsCall.create(messenger, callModel));
            }
        });
        callModel.getTheirVideoTracks().subscribe(new ValueChangedListener<ArrayListMediaTrack>() {

            @Override
            public void onChanged(ArrayListMediaTrack val, Value<ArrayListMediaTrack> valueModel) {
                jsCall.changeValue(JsCall.create(messenger, callModel));
            }
        });
        calls.put(id, jsCall);
    }
    return calls.get(id);
}
Also used : ArrayList(java.util.ArrayList) CallVM(im.actor.core.viewmodel.CallVM) ArrayListMediaTrack(im.actor.core.viewmodel.generics.ArrayListMediaTrack) CallMember(im.actor.core.viewmodel.CallMember) JsCall(im.actor.core.js.entity.JsCall) CallState(im.actor.core.viewmodel.CallState)

Aggregations

ArrayListMediaTrack (im.actor.core.viewmodel.generics.ArrayListMediaTrack)5 JsCall (im.actor.core.js.entity.JsCall)1 CallMember (im.actor.core.viewmodel.CallMember)1 CallState (im.actor.core.viewmodel.CallState)1 CallVM (im.actor.core.viewmodel.CallVM)1 ArrayList (java.util.ArrayList)1