ios - Method to consume web socket video stream with AVFoundation? -
i have resource sending video stream via websockets (i don't have control on transimission method). able read socket using socketrocket without problems, avplayer , ilk need nsurl, not stream of nsdata bytes.
here couple of solutions have tried:
custom
nsurlprotocolroute bytes socketnsurlprotocolclient. turns out, though,avplayer,mpmovieplayerviewcontrollernot usensurlconnection.this worded question tried writing bytes disk , appending them poor results.
use cocoahttpserver proxy stream. apis here (unless i'm missing something) aren't conducive writing arbitrary amount of data response.
how can trick avplayer playing video stream?
you should take @ avassetresourceloaderdelegate. allows initialize avasset custom url myapp://path/that/means/something/to/myapp , if have set [[avasset resourceloader] setdelegate:myobj queue:myqueue] media playback pipeline ask data , merely requires respond nsdata - see avassetresourceloadingdatarequest respondwithdata:.
Comments
Post a Comment