简体   繁体   English

Mediaplayer,exoplayer和音频流

[英]Mediaplayer, exoplayer and audio streaming

I am working on an Android app that streams audio. 我正在开发流音频的Android应用。 I am currently using Android MediaPlayer. 我目前正在使用Android MediaPlayer。 If I seek to a certain position in the audio file while streaming and at the same time seek to the same position in the same audio file that has been downloaded to my mac (using QuickTime Player), I don't come to the same audio position. 如果我在流式传输时在音频文件中定位到某个位置,同时又在已下载到我的Mac(使用QuickTime Player)的同一音频文件中搜索到同一位置,则不会得到相同的音频位置。 The display says that I am at the same position (02:49:54) but the audio is not playing the same sound (the streaming server is 20-40 seconds behind the correct position). 显示屏显示我在同一位置(02:49:54),但是音频播放的声音不同(流媒体服务器比正确位置晚20-40秒)。 I tried the Exoplayer Demo app and replaced one of the static urls with my own streaming url. 我尝试了Exoplayer Demo应用,并用自己的流URL替换了静态URL之一。 The same thing happens with Exoplayer. Exoplayer也会发生相同的情况。 My friend that works as an iOS developer has no problem seeking to the right position while streaming (using the same streaming server). 我的一位作为iOS开发人员的朋友在流媒体传输时(使用同一台流媒体服务器)毫无疑问地寻求正确的位置。 I also have the issue that sometimes the streaming stops seconds before the actual audio streaming is done. 我也有一个问题,有时在实际的音频流完成之前,流停止了几秒钟。 I hoped that Exoplayer would solve my issues, since the old MediaPlayer seems to be a bit buggy. 我希望Exoplayer可以解决我的问题,因为旧的MediaPlayer似乎有点毛病。 Does anyone have any idea on why I am having these issues? 有人对我为什么遇到这些问题有任何想法吗?

I have fixed the issue by added -t to the LAME command that I use to reduce the size of the mp3s. 我已通过在用于减小mp3大小的LAME命令中添加-t来解决此问题。 If you add -t option then no extra LAME info is written to the audio file: 如果添加-t选项,则不会将其他LAME信息写入音频文件:

Kaspers-MacBook-Pro:Bomben finne$ mediainfo bomben2.mp3 General Kaspers-MacBook-Pro:Bomben finne $ mediainfo bomben2.mp3一般

Complete name : bomben2.mp3 全名:bomben2.mp3

Format : MPEG Audio 格式:MPEG音频

File size : 67.9 MiB 档案大小:67.9 MiB

Duration : 3h 17mn 片长:3h 1700万

Overall bit rate mode : Constant 整体比特率模式:恒定

Overall bit rate : 48.0 Kbps 整体比特率:48.0 Kbps

Audio 音频

Format : MPEG Audio 格式:MPEG音频

Format version : Version 1 格式版本:版本1

Format profile : Layer 3 格式配置文件:第3层

Duration : 3h 17mn 片长:3h 1700万

Bit rate mode : Constant 比特率模式:恒定

Bit rate : 48.0 Kbps 比特率:48.0 Kbps

Channel(s) : 1 channel 频道:1个频道

Sampling rate : 32.0 KHz 采样率:32.0 KHz

Compression mode : Lossy 压缩方式:有损

Stream size : 67.9 MiB (100%) 流大小:67.9 MiB(100%)

But still this should be fixed, since it works fine on iOS. 但是仍然应该解决此问题,因为它在iOS上可以正常工作。 Now you can reproduce the error by running: 现在,您可以通过运行以下命令来重现该错误:

lame -mm --preset cbr 48 source.mp3 output.mp3 me脚-mm-预设cbr 48 source.mp3 output.mp3

and then to make it work: 然后使其工作:

lame -t -mm --preset cbr 48 source.mp3 output.mp3 me脚-t -mm-预设cbr 48 source.mp3 output.mp3

I have created this issue: https://code.google.com/p/android/issues/detail?id=158627&thanks=158627&ts=1425655288 我已创建此问题: https : //code.google.com/p/android/issues/detail?id=158627&thanks=158627&ts=1425655288

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM