When showing Apple’s example HLS video in preview it crashes on OSX and only plays the sound on iOS. For the latter that also goes for other videostreams I have tested (none-public, so I can’t disclose those).
I’ve found the issue of why there is only audio on iOS. This is because of these two methods in VideoImpl.mm:
int getWidth(void * videoState)
{
VideoState * vs = (VideoState*)videoState;
return [vs->Asset naturalSize].width;
}
int getHeight(void * videoState)
{
VideoState * vs = (VideoState*)videoState;
return [vs->Asset naturalSize].height;
}
naturalSize will not contain the correct size if the video is a HTTP Live Stream, as it has not been properly initialised at that point. I guess this is also why naturalSize is deprecated, as the documentation suggests reading the size-values from the video track in the stream.
I hope a fix for this can find its way into 0.36.0
Thanks for digging further. I took a quick stab at trying to deal with your findings, but unfortunately it’s a bit more complicated than that; switching to [AVAssetTrack naturalSize] (like the documentation suggest) doesn’t help, because there’s no AVAssetTracks with media-type AVMediaTypeVideo either at that point. Which seems a bit bizarre to me, as the asset is reported as loaded at that time.
Yeah. I think I also tried to check in updateTexture() if there were indeed any tracks with video at any point, to no avail.
A workaround could be to use the Width and Height parameters from the tag if the naturalSize is unavailable? Or perhaps the size reported by the actual pixelbuffer in updateTexture(), as that one is accurate.
I suspect consulting the pixel-buffer will be the correct fix, but unfortunately this is a bigger change, as the higher level abstraction assumes it can query the size once the video is reported as loaded.
I unfortunately don’t really think we have a realistic chance of getting a fix for this into 0.36.0, because the person maintaining this code is currently on vacation. So unless I can find a minimal fix, video stream support will probably have to wait a bit.