音频流IOS seekToTime
我第一次使用流式音频文件,我的音频文件是流式的,seekTOTime也在工作,即从滑块的新选定位置流式播放音频,但之后我的滑块被弹动,我得到错误的当前时间或播放时间音频流IOS seekToTime,ios,Ios,我第一次使用流式音频文件,我的音频文件是流式的,seekTOTime也在工作,即从滑块的新选定位置流式播放音频,但之后我的滑块被弹动,我得到错误的当前时间或播放时间 - (IBAction)currentTimeSliderValueChanged:(id)sender { [streamer seekToTime:self.currentTimeSlider.value * duration]; } 我正在更新我的滑块值 if (streamer.bitRate != 0.0)
- (IBAction)currentTimeSliderValueChanged:(id)sender
{
[streamer seekToTime:self.currentTimeSlider.value * duration];
}
我正在更新我的滑块值
if (streamer.bitRate != 0.0)
{
double duration = streamer.duration;
double progress = streamer.progress;
int minProgress = (int)progress/60%60;
int secProgress = (int)progress%60;
double totalSec = CMTimeGetSeconds(asset.duration);
int minDur = (int)totalSec/60%60;
int secDur = (int)totalSec%60;
if(duration > 0)
{
[self.elapsedTimeLabel setText:
[NSString stringWithFormat:@"%d:%d",
minProgress,secProgress]];
[self.remainingTimeLabel setText:[NSString stringWithFormat:@"%d:%d",minDur,secDur]];
[self.currentTimeSlider setEnabled:YES];
[self.currentTimeSlider setValue: progress/duration];
}
}
但我在seekToTime之后得到了错误的elapsedTimeLabel值,当流结束时,我得到了错误
“AudioQueue以意外方式更改了状态。”
“音频队列获取当前时间失败。错误:ˇ˚ä-66678”是否设置了滑块值?我正在调用操作-(iAction)currentTimeSliderValueChanged:(id)滑块的值更改控件事件上的发送方。Slider从这个方法中获取它的值。加载流时,no no no。你设置了滑块的最大值和最小值了吗?哦,我是从Interface builder设置的。我的最大值是1,最小值是0。只有在使用seekToTime之后,它才给了我错误的时间。若我不改变滑块的位置,那个么流媒体就像一个符咒。