Skip to main content

Setting Audio Attributes

The Audio attributes of playback can be set with API setAudioAttributes. There are 5 audio attributes which can be configured:

  • contentType: the attribute describing the content type of the audio signal, such as speech, or music

  • flags: the flags of audio playback

  • usage: the attribute describing what is the intended use of the audio signal, such as alarm or movie

  • allowedCapturePolicy: Specifies whether the audio may or may not be captured by other apps or the system

  • spatializationBehavior: the behavior affecting whether spatialization will be used

JAVA
// Create audio attributes with builder
OTVAudioAttributes audioAttributes = new OTVAudioAttributes.Builder()
    .setContentType(OTVAudioAttributes.AUDIO_CONTENT_TYPE_MUSIC)
    .setFlags(OTVAudioAttributes.FLAG_AUDIBILITY_ENFORCED)
    .setUsage(OTVAudioAttributes.USAGE_GAME)
    .setAllowedCapturePolicy(OTVAudioAttributes.ALLOW_CAPTURE_BY_NONE)
    .setSpatializationBehavior(OTVAudioAttributes.SPATIALIZATION_BEHAVIOR_NEVER)
    .build();
// Create configuration with builder
OTVPlayerConfiguration configuration =
  new OTVPlayerConfiguration.Builder()
    .setAudioAttributes(audioAttributes) // Set audio attributes
    .build();  //Build the player configuration
// Here videoView is the instance of OTVVideoView.
videoView.setPlayerConfiguration(configuration);    
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.