をExoPlayer
でストリーミングしようとしました。 URLは:ExoPlayerを使用してAACファイルのgetDuration()を取得できません
STREAM_URL_1 = "http://storage.googleapis.com/exoplayer-test-media-0/play.mp3"
STREAM_URL_2 = "https://s3-ap-southeast-1.amazonaws.com/ok.talk.channels/zakirkhan/Zakir+khan+-+when+my+father+took+my+gf%27s+call.aac"
両方のURLは、プレーが、私は.aacファイルですSTREAM_URL_2ためgetDuration()
を取得することはできませんよ。 .mp3が動作します。
私は以下のようにしています。 2番目のURLにはどのようにしてgetDuration()
を取得しますか。 getDuration()
が機能しない場合でもseekTo()
は機能しません。
私はどのような変更を行う必要がありますか? Extractor
を変更する必要がありますか?
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, MIN_BUFFER_MS, MIN_RE_BUFFER_MS);
playerControl = new PlayerControl(player);
Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
private static final String STREAM_URL = "http://storage.googleapis.com/exoplayer-test-media-0/play.mp3";
uri = Uri.parse(STREAM_URL);
// Build the video and audio renderers.
DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
null);
String userAgent = Util.getUserAgent(this, "MyMediaPlayer");
DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent, true);
ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
null, true);
// Invoke the callback.
TrackRenderer[] renderers = new TrackRenderer[1];
renderers[RadioPlayer.TYPE_AUDIO] = audioRenderer;
player.prepare(renderers);
player.seekTo(0);
player.setPlayWhenReady(true);
はい、あなたは正しいです。同じことがAACファイルの問題でもあります。しかし、私が 'MediaPlayer'を使用していた時には、デュレーションと場所の両方を取得することが可能でした。どのようにそれを複製することができますか? –