我有一个用于我的网站的广播应用程序,可以在我的 EVO 和其他设备中运行良好,但一位用户告诉我,在他的三星 Galaxy S 中,它会冻结应用程序(他给我发了一个视频 女巫我可以看到媒体播放器服务接到电话并启动,但没有声音出来,应用程序冻结没有崩溃屏幕来发送报告或它只是冻结什么都没有), 我没有要测试的 Galaxy,那我该怎么办?还有其他人有类似的问题吗?我尝试在此处粘贴我的代码,但有人决定关闭我的问题,没有任何建议。我的应用程序所做的只是从主活动一个按钮调用媒体播放器添加我的 MP3 流的 URL 并启动付款人。
Button canal1 = (Button) findViewById(R.id.bcanal1);
canal1.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
mUrl = "http://67.212.165.106:8161";
textRadioName.setText("you are listening to VARIADO!");
Intent i = new Intent (ChevereMovilActivity.this, PlayerService.class);
startService(i);
PlayerService.setSong(mUrl, "Temp Song", null);
start();
}});
启动方法
@Override
public void start() {
if (PlayerService.getInstance() != null) {
PlayerService.getInstance().startMusic();
}
}
在清单中
<service android:name=".PlayerService"
android:label="@string/app_name">
<intent-filter>
</intent-filter>
</service>
就像我说的那样,它可以在我的前夕工作,但不能在三星Galaxy S上工作我正在使用安卓 2.2
该服务被冻结,因为三星Galaxy S无法准备流,您可能使用的是mediaPlayer.prepare()而不是mediaPlayer.prepareAsync()。
我认为这是某些Galaxy设备中未记录的"怪癖"。问题是流格式。如果您在控制台中编写:
wget -S -O stream http://67.212.165.106:8161
和他们:
head -n 12 stream
您可以看到类似以下内容:
ICY 200 OK
icy-notice1:<BR>This stream requires <a href="http://www.winamp.com/">Winamp</a><BR>
icy-notice2:SHOUTcast Distributed Network Audio Server/Linux v1.9.8<BR>
icy-name:My Station name
icy-genre:Various
icy-url:http://www.radiokolergan.com
content-type:audio/mpeg
icy-pub:1
icy-br:64
qOCéúÐX43‘¤]ÝáÅQ(;Œ6½v<‡ÿò„
我认为问题出在这个标题上。如果您尝试使用其他网址(例如:http://195.55.74.213/rtve/radio4.mp3?GKID=804c9f24cb4811e1af4600163ea2c743
),则不会获得此标头,并且它在三星Galaxy Tab和其他设备中可以很好地重现。