Android Exoplayer Audio Streaming无法正常工作

时间:2022-07-17 18:58:04
String url = "http://www.noiseaddicts.com/free-samples-mp3/?id=2558";
Uri radioUri = Uri.parse(url);

Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
String userAgent = Util.getUserAgent(Player.this, "ExoPlayerDemo");
DataSource dataSource = new DefaultUriDataSource(Player.this, null, userAgent);
ExtractorSampleSource sampleSource = new ExtractorSampleSource(
          radioUri, dataSource, allocator, BUFFER_SEGMENT_SIZE * BUFFER_SEGMENT_COUNT);
MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource, MediaCodecSelector.DEFAULT);

player.prepare(audioRenderer);
player.sendMessage(audioRenderer,MediaCodecAudioTrackRenderer.MSG_SET_VOLUME, 1f);
player.setPlayWhenReady(true);

player.release();

in this code audio is not playing and and it is giving Skipped 60 frames! The application may be doing too much work on its main thread. please give suggestions

在这段代码中,音频没有播放,它正在播放Skipped 60帧!应用程序可能在其主线程上做了太多工作。请给出建议

1 个解决方案

#1


1  

Url "http://www.noiseaddicts.com/free-samples-mp3/?id=2558" is not correct. It's for web page.

网址“http://www.noiseaddicts.com/free-samples-mp3/?id=2558”不正确。它适用于网页。

don't reales before audio is played.

在播放音频之前不要重新定价。

#1


1  

Url "http://www.noiseaddicts.com/free-samples-mp3/?id=2558" is not correct. It's for web page.

网址“http://www.noiseaddicts.com/free-samples-mp3/?id=2558”不正确。它适用于网页。

don't reales before audio is played.

在播放音频之前不要重新定价。