Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class MediaTrack

  1. Object
  2. MediaTrack

One stream of audio or video: the local camera or microphone, or what arrives from the other side.

A muted track keeps flowing as silence or black frames, so unmuting is instant and the other side’s connection never notices.

Fields

public static final String AUDIO = "audio"getKind() of a microphone or a remote voice.
public static final String VIDEO = "video"getKind() of a camera or a remote picture.

Methods

public String getKind()
public boolean isVideo()
public boolean isLocal()Whether this is this device’s own camera or microphone.
public boolean isEnabled()
public void setEnabled(boolean enabled)Mutes (false) or unmutes (true) the track.
public void switchCamera()Switches a local video track between the front and back cameras.
public void release()Stops the camera or microphone behind a local track.

Inherited methods

Field details

AUDIO

public static final String AUDIO = "audio"
getKind() of a microphone or a remote voice.

VIDEO

public static final String VIDEO = "video"
getKind() of a camera or a remote picture.

Method details

getKind

public String getKind()

isVideo

public boolean isVideo()

isLocal

public boolean isLocal()
Whether this is this device’s own camera or microphone.

isEnabled

public boolean isEnabled()

setEnabled

public void setEnabled(boolean enabled)
Mutes (false) or unmutes (true) the track.

switchCamera

public void switchCamera()
Switches a local video track between the front and back cameras. Does nothing for any other track.

release

public void release()
Stops the camera or microphone behind a local track. A track cannot be restarted; open new media instead. Remote tracks end with their connection, so this does nothing for them.