CONNECT Player SDK 5 for Android
5.42.x 5.41.x 5.40.x 5.39.x 5.38.x 5.37.x 5.36.x 5.35.x 5.34.x 5.33.x 5.32.x 5.31.x 5.30.x 5.29.x 5.28.x 5.27.x 5.26.x 5.25.x 5.24.x 5.23.x 5.22.x 5.21.x 5.20.x 5.19.x 5.18.x 5.17.x 5.16.x 5.15.x 5.14.x 5.13.x 5.12.x 5.11.x 5.10.x 5.9.x 5.8.x 5.7.x 5.6.x 5.5.x
5.42.x 5.41.x 5.40.x 5.39.x 5.38.x 5.37.x 5.36.x 5.35.x 5.34.x 5.33.x 5.32.x 5.31.x 5.30.x 5.29.x 5.28.x 5.27.x 5.26.x 5.25.x 5.24.x 5.23.x 5.22.x 5.21.x 5.20.x 5.19.x 5.18.x 5.17.x 5.16.x 5.15.x 5.14.x 5.13.x 5.12.x 5.11.x 5.10.x 5.9.x 5.8.x 5.7.x 5.6.x 5.5.x

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);