I have a NSData object, obtained from a URL request.Now I don’t know how to read it.
However in my application I don’t know if the data contains a video or not, so I would know:
- How to know if NSData has some video inside it?
- How to interpret the data, reading it byte per byte?
I’m not familiar with the particular API you’re using so I can’t say what the code should be, but any web/HTTP client library should provide you the
Content-Typeof the data as well as the data itself. Use the Content-Type (and only the Content-Type; doing otherwise can lead to security bugs) to determine how to interpret the content. For example, if the Content-Type (also known as MIME type) starts withvideo/, then the content is definitely video; the part after the slash will tell you the specific format to interpret it as.