Controlling Active Media

The last section dealt with migrating from using IceLink 2 conferences to IceLink 3 connections. This section handles what to do with these connections once they are active, and focuses on how to control the flow of media.

Pausing and Resuming Local Media

With IceLink 2, local audio is paused and resumed by invoking the PauseAudio and ResumeAudio methods of the LocalMediaStream class, while local video was paused and resumed by invoking the PauseVideo and ResumeVideo methods.

// IceLink 2
localMediaStream.PauseAudio();
localMediaStream.ResumeAudio();

localMediaStream.PauseVideo();
localMediaStream.ResumeVideo();
// IceLink 2
localMediaStream.pauseAudio();
lcoalMediaStream.resumeAudio();

localMediaStream.pauseVideo();
localMediaStream.resumeVideo();
// IceLink 2
[localMediaStream pauseAudio];
[localMediaStream resumeAudio];

[localMediaStream pauseVideo];
[localMediaStream resumeVideo];
// IceLink 2
localMediaStream.pauseAudio()
localMediaStream.resumeAudio()

localMediaStream.pauseVideo()
localMediaStream.resumeVideo()
// IceLink 2
localMediaStream.pauseAudio()
localMediaStream.resumeAudio()

localMediaStream.pauseVideo()
localMediaStream.resumeVideo()

With IceLink 3, to pause or resume audio, use the AudioSource property of your LocalMedia instance to access the FM.IceLink.AudioSource instance associated with your local audio. You can then start and stop audio using the Stop and Start methods of the AudioSource instance. For video, you access the VideoSource property instead.

Note that with IceLink 3, starting or stopping audio or video is an asynchronous action. The Start and Stop methods both return a promise. If you need to wait until the action is complete, you can wait on the result of the promise. Refer to Working with Promises for more information.

// IceLink 3
localMedia.AudioSource.Stop();
localMedia.AudioSource.Start();

localMedia.VideoSource.Stop();
localMedia.VideoSource.Start();
// IceLink 3
localMedia.getAudioSource().stop();
localMedia.getAudioSource().start();

localMedia.getVideoSource().stop();
localMedia.getVideoSource().start();
// IceLink 3
[[localMedia audioSource] stop];
[[localMedia audioSource] start];

[[localMedia videoSource] stop];
[[localMedia videoSource] start];
// IceLink 3
localMedia.audioSource().stop()
localMedia.audioSource().start()

localMedia.videoSource().stop()
localMedia.videoSource().start()
// IceLink 3
localMedia.getAudioSource().stop();
localMedia.getAudioSource().start();

localMedia.getVideoSource().stop();
localMedia.getVideoSource().start();


Migration Steps

  • Replace calls to PauseAudio with AudioSource.Stop().
  • Replace calls to ResumeAudio with AudioSource.Start().
  • Replace calls to PauseVideo with VideoSource.Stop().
  • Replace calls to ResumeVideo with VideoSource.Start().

More Information

Muting and Unmuting Local and Remote Media

With IceLink 2, local and remote audio are muted and unmuted using the MuteAudio and UnmuteAudio methods of the MediaStream class, while local and remote video are muted and unmuted using the MuteVideo and UnmuteVideo methods.

// IceLink 2
mediaStream.MuteAudio();
mediaStream.UnmuteAudio();

mediaStream.MuteVideo();
mediaStream.UnmuteVideo();
// IceLink 2
mediaStream.muteAudio();
mediaStream.unmuteAudio();

mediaStream.muteVideo();
mediaStream.unmuteVideo();
// IceLink 2
[mediaStream muteAudio];
[mediaStream unmuteAudio];

[mediaStream muteVideo];
[mediaStream unmuteVideo];
// IceLink 2
mediaStream.muteAudio()
mediaStream.unmuteAudio()

mediaStream.muteVideo()
mediaStream.unmuteVideo()
// IceLink 2
mediaStream.muteAudio();
mediaStream.unmuteAudio();

mediaStream.muteVideo();
mediaStream.unmuteVideo();

With IceLink 3, you can determine whether audio or video is muted by accessing the AudioMuted and VideoMuted properties of your LocalMedia or RemoteMedia instance. If you want to mute the media object, set the value to true; if you want to unmute, set the value to false.

// IceLink 3
media.AudioMuted = true;
media.AudioMuted = false;

media.VideoMuted = true;
media.VideoMuted = false;
// IceLink 3
media.setAudioMuted(true);
media.setAudioMuted(false);

media.setVideoMuted(true);
media.setVideoMuted(false);
// IceLink 3
[media setAudioMuted:true];
[media setAudioMuted:false];

[media setVideoMuted:true];
[media setVideoMuted:false];
// IceLink 3
media.setAudioMuted(true)
media.setAudioMuted(false)

media.setVideoMuted(true)
media.setVideoMuted(false)
// IceLink 3
media.setAudioMuted(true);
media.setAudioMuted(false);

media.setVideoMuted(true);
media.setVideoMuted(false);

In addition, the media sources, media pipes, and media sinks that make up a track can be individually muted and unmuted. Muting and unmuting the track is a shortcut to apply muting to each element in the track.

Migration Steps

  • Replace calls to MuteAudio with AudioMuted = true.
  • Replace calls to UnmuteAudio with AudioMuted = false.
  • Replace calls to MuteVideo with VideoMuted = true.
  • Replace calls to UnmuteVideo with VideoMuted = false.

More Information

Getting a List of Local Media Devices

With IceLink 2, you can retrieve a list of devices using the GetAudioDeviceNames and GetVideoDeviceNames methods of your LocalMediaStream instance.

// IceLink 2
var audioInputs = localMediaStream.GetAudioDeviceNames();
var videoInputs = localMediaStream.GetVideoDeviceNames();
// IceLink 2
String[] audioInputs = localMedia.getAudioDeviceNames();
String[] videoInputs = localMedia.getVideoDeviceNames();
// IceLink 2
NSMutableArray* audioInputs = [localMedia getAudioDeviceNames];
NSMutableArray* videoInputs = [localMedia getVideoDeviceNames];
// IceLink 2
var audioInputs = localMedia.getAudioDeviceNames()
var videoInputs = localMedia.getVideoDeviceNames()
// IceLink 2
var audioInputs = localMedia.getAudioDeviceNames();
var videoInputs = localMedia.getVideoDeviceNames();


With IceLink 3, the same devices are returned using the GetAudioSourceInputs and GetVideoSourceInputs methods of your LocalMedia instance. In IceLink 3, this is an asynchronous action. The method returns a promise, that contains a set of SourceInput instances when it resolves.

// IceLink 3
localMedia.GetAudioSourceInputs().Then((FM.IceLink.SourceInput[] audioInputs) =>
{
    ...
});

localMedia.GetVideoSourceInputs().Then((FM.IceLinkSourceInput[] videoInputs) =>
{
    ...
});
// IceLink 3
localMedia.getAudioSourceInputs().then((fm.icelink.SourceInput[] audioInputs) -> {
    ...
});

localMedia.getVideoSourceInputs().then((fm.icelink.SourceInput[] videoInputs) -> {
    ...
});
// IceLink 3
[[localMedia getAudioSourceInputs] thenWithResolveAction: ^(NSMutableArray* audioInputs) {
    ...
}];

[[localMedia getVideoSourceInputs] thenWithResolveAction: ^(NSMutableArray* videoInputs) {
}];
// IceLink 3
localMedia.getAudioSourceInputs().then(resolveAction: { (audioInputs:[FMIceLinkSourceInput]) in
    ...
})

localMedia.getVideoSourceInputs().then(resolveAction: { (videoInputs:[FMIceLinkSourceInput]) in
    ...
})
// IceLink 3
localMedia.getAudioSourceInputs().then(function(audioInputs) {
    ...
});

localMedia.getVideoSourceInputs().then(function(videoInputs) {
    ...
});


Migration Steps

  • Replace calls to GetAudioDeviceNames with GetAudioSourceInputs.
  • Replace calls to GetVideoDeviceNames with GetVideoSourceInputs.

More Information

Switching Local Media Devices

With IceLink 2, you can switch audio and video devices using the SetAudioDeviceNumber and SetVideoDeviceNumber methods of your LocalMediaStream instance.

// IceLink 2
localMediaStream.SetAudioDeviceNumber(0);
localMediaStream.SetVideoDeviceNumber(0);

// IceLink 2
localMediaStream.setAudioDeviceNumber(0);
localMediaStream.setVideoDeviceNumber(0);
// IceLink 2
[localMediaStream setAudioDeviceNumberWithDeviceNumber:0];
[localMediaStream setVideoDeviceNumberWithDeviceNumber:0];
// IceLink 2
localMediaStream.setAudioDeviceNumber(deviceNumber: 0)
localMediaStream.setVideoDeviceNumber(deviceNumber: 0)
// IceLink 2
localMediaStream.setAudioDeviceNumber(0);
localMediaStraem.setVideoDEviceNumber(0);


With IceLink 3, you can switch audio and video devices using the ChangeAudioSourceInput and ChangeVideoSourceInput methods of your LocalMedia instance. In IceLink 3, this is an asynchronous action. The method returns a promise that resolves when the media device has been switched.

// IceLink 3

localMedia.ChangeAudioSourceInput(0).Then(result =>
{
    Console.WriteLine("audio source changed");
});

localMedia.ChangeVideoSourceInput(0).Then(result =>
{
    Console.WriteLine("video source changed");
});
// IceLink 3
localMedia.changeAudioSourceInput(0).then(result =>
{
    System.out.println("audio source changed");
});

localMedia.changeVideoSourceInput(0).then(result =>
{
    System.out.println("video source changed");
});
// IceLink 3
[[localMedia changeAudioSourceInputWithAudioSourceInput:0] thenWithResolveAction: ^(NSObject* result) {
    NSLog(@"audio source changed");
}];

[[localMedia changeVideoSourceInputWithVideoSourceInput:0] thenWithResolveAction: ^(NSObject* result) {
    NSLog(@"video source changed");
}];
// IceLink 3
localMedia.changeAudioSourceInput(audioSourceInput: 0).then(resolveAction: { (result:NSObject) in 
    print("audio source changed")
})

localMedia.changeVideoSourceInput(videoSourceInput: 0).then(resolveAction: { (result:NSObject) in
    print("video source changed")
})
// IceLink 3
localMedia.changeAudioSourceInput(0).then(function(result) {
    console.log("audio source changed");
});

localMedia.changeVideoSourceInput(0).then(function(result) {
    console.log("video source changed");
});


Migration Steps

  • Replace calls to SetAudioDeviceNumber with ChangeAudioSourceInput.
  • Replace calls to SetVideoDeviceNumber with ChangeVideoSourceInput.

More Information

Wrapping Up

This section covered how to mute and unmute audio, as well as how to change your audio device during a video conference. The next section deals with extensibility, and focuses on how to migrate your IceLink 2 extensions over to IceLink 3.