swift - ios9 / swift2 / xcode7+ AVplayer icecast doesn't process streaming without file extension -
how play stream icecast2 not have file extension
example stream url: http://icecast:8044/channel-123?a=hash
format: mp4a
the code seems working on files extension, not on files without.
var player = avplayer(); let playeritem = avplayeritem(url:nsurl(string:"http://host/file.mp4a")!); player = avplayer(playeritem:playeritem) let playercontroller = avplayerviewcontroller() playercontroller.view.frame = self.view.frame playercontroller.player = player self.addchildviewcontroller(playercontroller) self.view.addsubview(playercontroller.view) player.play()
edit: when stream address ends without file extension (the file on server stored without file extension .mp3, .mp4,..) avplayer not play anything(http://example.com/file) ... if file name contains file extension works (http://example.com/file.mp3)
it seems confusing live streaming , loading media files server.
if talking live streaming:
1) file extension has no impact on avplayer ability play stream (avplayer plays audio link, example: http://icecast.omroep.nl/radio1-bb-aac).
2) nevertheless, file format matter (for more information check docs here):
what specifics of video , audio formats supported?
although protocol specification not limit video , audio formats, current apple implementation supports following formats:
video: h.264 baseline level 3.0, baseline level 3.1, main level 3.1, , high profile level 4.1. audio: he-aac or aac-lc 48 khz, stereo audio mp3 (mpeg-1 audio layer 3) 8 khz 48 khz, stereo audio ac-3 (for apple tv, in pass-through mode only)
if have own server , want provide ability streaming audio/video, need perform setup actions described here.
Comments
Post a Comment