本文整理了Java中com.google.android.exoplayer2.util.Util.getAudioContentTypeForStreamType()
方法的一些代码示例,展示了Util.getAudioContentTypeForStreamType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getAudioContentTypeForStreamType()
方法的具体详情如下:
包路径:com.google.android.exoplayer2.util.Util
类名称:Util
方法名:getAudioContentTypeForStreamType
[英]Returns the C.AudioContentType corresponding to the specified C.StreamType.
[中]返回与指定的C.StreamType对应的C.AudioContentType。
代码示例来源:origin: google/ExoPlayer
/**
* Sets the stream type for audio playback, used by the underlying audio track.
* <p>
* Setting the stream type during playback may introduce a short gap in audio output as the audio
* track is recreated. A new audio session id will also be generated.
* <p>
* Calling this method overwrites any attributes set previously by calling
* {@link #setAudioAttributes(AudioAttributes)}.
*
* @deprecated Use {@link #setAudioAttributes(AudioAttributes)}.
* @param streamType The stream type for audio playback.
*/
@Deprecated
public void setAudioStreamType(@C.StreamType int streamType) {
@C.AudioUsage int usage = Util.getAudioUsageForStreamType(streamType);
@C.AudioContentType int contentType = Util.getAudioContentTypeForStreamType(streamType);
AudioAttributes audioAttributes =
new AudioAttributes.Builder().setUsage(usage).setContentType(contentType).build();
setAudioAttributes(audioAttributes);
}
代码示例来源:origin: brianwernick/ExoMedia
public void setAudioStreamType(int streamType) {
@C.AudioUsage
int usage = Util.getAudioUsageForStreamType(streamType);
@C.AudioContentType
int contentType = Util.getAudioContentTypeForStreamType(streamType);
AudioAttributes audioAttributes = new AudioAttributes.Builder()
.setUsage(usage)
.setContentType(contentType)
.build();
sendMessage(C.TRACK_TYPE_AUDIO, C.MSG_SET_AUDIO_ATTRIBUTES, audioAttributes);
}
内容来源于网络,如有侵权,请联系作者删除!