ios - Streaming multiple music with AVPlayer -
i have app want make requires streaming audio files web server. use avplayer
player. problem is, responses receiving server has 2 audio files on it. , makes streaming hard. audio player ui way this:
i have slider streamed time ranges (the black one) , slider avplayer.currenttime
. have 2 audio music streamed , music durations added 8:46. first music has 6 minutes duration , second music has 1:46. can see in above photo, streamed time ranges slider indicates avasset
has streamed first music. problem is, can't continue streaming , playing next music when first 1 has reached it's end. stop , slider value gets 0.
what want accomplish when first item has reached end, avplayer
load player item , second music. continue play , slider continue move.
is possible? suggestions? experts.
to load audio files 1 after other, can use avqueueplayer.
nsurl *song1 = [nsurl urlwithstring:@"audio url1"]; nsurl *song2 = [nsurl urlwithstring:@"audio url2"]; avplayeritem *playeritem1 = [[avplayeritem alloc] initwithurl:song1]; avplayeritem *playeritem2 = [[avplayeritem alloc] initwithurl:song2]; nsarray *songs = @[playeritem1, playeritem2]; self.queueplayer = [[avqueueplayer alloc] initwithitems:songs]; [self.queueplayer play];
hope might you.
Comments
Post a Comment