This guide gives an overview of the supported video and audio formats, describes how to control audio, get information about available web cameras and microphones, etc.

Codecs

Google Chrome and Chromium differ in several ways, including the sets of audio and video codecs they support.

The table below displays which codecs are supported by the codebase of corresponding browsers.

  Chromium Google Chrome
AAC   yes
H.264   yes
MP3   yes
MP4   yes
Opus yes yes
Theora yes yes
Vorbis yes yes
VP8 yes yes
VP9 yes yes
WAV yes yes


As you may see, Google Chrome supports H.264, MP3, and MP4 codecs while Chromium does not. The reason is that these codecs are proprietary and cannot be used in an open-source or a commercial project without obtaining licenses from corresponding patent holders.

Different codecs have different patent holders. For example, in order to use H.264, companies must acquire the license from MPEG-LA company. You can read more about their license terms on the MPEG-LA’s website.

Proprietary Codecs

Patent holders do not license codecs to the software that represents only a part of the final product deployed to the end users, e.g. libraries like JxBrowser.

In order to support H.264, MP3, MP4, and other proprietary codecs in your products, you need to acquire appropriate licenses.

If you need to play MP3, MP4, and H.264 formats on the web pages loaded in JxBrowser, you need to perform the following actions:

  1. Contact the patent holder, e.g. MPEG-LA, and obtain a license to use the proprietary codecs you need.
  2. Contact our support team and request a custom build of JxBrowser with the proprietary codecs enabled. If you are do not have a JxBrowser license yet, please contact us at sales@teamdev.com.

With the license and a custom JxBrowser build you will be able to load web pages with the MP3, MP4, and H.264 formats, and play audio and video files, just like in Google Chrome.

Video

JxBrowser fully supports HTML5 <video> element and can play video in the supported formats.

If the library cannot play a video, or a video format is unsupported, JxBrowser suggests to download the video file. Please see Downloads for guidance on managing downloads.

HTML5 Video

Audio

Controlling Audio

Using Audio you can find out whether audio is playing on the loaded web page:

boolean audioPlaying = audio.isPlaying();

You can mute or unmute audio on the loaded web page if required:

audio.mute();
audio.unmute();

To check whether audio is muted use the following code:

boolean audioMuted = audio.isMuted();

Audio Events

To find out whether audio has started/stopped playing on the loaded web page you can subscribe to the following events:

browser.on(AudioStartedPlaying.class, event -> {});
browser.on(AudioStoppedPlaying.class, event -> {});

DRM

Widevine

JxBrowser does not support Widevine at the moment. Which currently makes web services like Netflix, Amazon Prime, and others that use Widevine to distribute content, unavailable via JxBrowser/Chromium.

Camera & Microphone

JxBrowser supports web camera and microphone.

You can get information about all available media stream devices using the following code:

MediaDeviceService mediaDeviceService = engine.getMediaDeviceService();

// Get all available video devices, e.g. web camera.
Collection<MediaDevice> videoDevices = mediaDeviceService.getMediaStreamDevices(
        MediaDeviceType.MEDIA_DEVICE_TYPE_VIDEO);

// Get all available audio devices, e.g. microphone.
Collection<MediaDevice> audioDevices = mediaDeviceService.getMediaStreamDevices(
        MediaDeviceType.MEDIA_DEVICE_TYPE_AUDIO);
Go Top