Video white

A recent task I had to achieve was to play a video for several seconds and extract a frame as a JPG several seconds in. I did not know the dimensions of the video ahead of time, so hoped to extract that information out of the video metadata, and create the video object at this point. Sounds simple enough!

However, this only seemed to work about 75% of the time. Occasionally I was seeing just white in certain videos, like they weren’t attached correctly to the Video object(despite receiving the metadata correctly). My theory was that perhaps the metadata was received after the FLV began playing, and that perhaps there can be problems creating a Video object and attaching a NetStream to it, after it has begun playing.

So I tried creating the Video object and then resizing after receiving the FLV metadata, but the resize seemed to have no effect when extracting the Bitmap Data. But finally found a solution – the Bitmap Data extracted correctly, if I placed the Video object inside a MovieClip and extracted the Bitmap Data of the MovieClip instead of the resized Video object.

Interactive developer, Author - iOS development with Swift - book coming 2017 https://manning.com/books/ios-development-with-swift

Tagged with:
Posted in Flash

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: