我制作了一个播放广告+音频+广告的流程序。我播放第一个广告,然后我切换到音频,然后我在播放最后一个广告失败,我得到错误(38,0)。我检查了我已设置数据源,onPrepareListener,我尝试了迄今为止我能找到的所有东西,但仍然在android 4.1.1上出现此错误 我的方法MPStarting后我得到错误,我甚至没有达到最终广告的onPrepared方法。如果有任何信息你需要更多PLZ让我知道谢谢。 这是相关代码的一部分
MPStarting(Track)
{ try
{
if (_playlist !=null && _playlist.GetCurrent() != null)
{
Episode ep = (Episode) _playlist.GetCurrent();
_player = new MediaPlayer();
AdsInfo startAd = ep.getAdWithType(PlayTime.start_ad);
AdsInfo endAd = ep.getAdWithType(PlayTime.end_ad);
if(currAudio == null && startAd != null)
currAudio = startAd;
else if(currAudio == startAd )
currAudio = ep;
else if (currAudio instanceof Episode && endAd != null)
currAudio = ep.getAdWithType(PlayTime.end_ad);
}
if(_player != null)
{
_player.setDataSource(dataSource);
_player.setOnPreparedListener(this);
_player.setOnCompletionListener(this);
_player.setOnBufferingUpdateListener(this);
_player.setOnSeekCompleteListener(this);
_player.setOnErrorListener(this);
_player.prepareAsync();
}
catch (Exception e)
{
Log.i("mpcPlayer","MPStarting "+ e.getLocalizedMessage());
}
}
}
@Override
public void onCompletion(MediaPlayer mp)
{
//here i check on current playing
//i always stop player if it is playing ,reset,release and make player = null
// then i call MPStarting and i send the current audio then return
}
答案 0 :(得分:0)
我认为我发现了我的问题,我有时候调用getCurrentPosition()似乎玩家当时没有准备好。我猜这个错误是关于在玩家处于正确状态时调用方法。