Skip to main content
Leafcutter
Inspiring
October 15, 2013
Question

StageVideo instability on iOS7 - bizarre solution

  • October 15, 2013
  • 1 reply
  • 577 views

I have encountered an issue with stageVideo for which the only solutution I have found is quite bizarre.

I have several apps that use stageVideo with (previously) no problems.  After the update to iOS7 I obviously had to update to AIR 3.9 to get them to work again.  The apps are all play one of several videos triggered by user's button taps.  I have since noticed a problem where sometimes when a new video is selected the video doesn't play (screen is black) but the audio can still be heard.

I have tried many different ways to start and stop the video - things like pausing the netstream before switching video, destroying the netstream and recreating it, pausing before playing, pausing before reattaching the netstream, not pausing etc etc but the problem always appears sooner or later.

Bizarrely I have found that if I overlay a text field on top of the video and output error messages to the text field then the black screen issue completely disappears!  Every single time the video plays correctly.  As soon as I recompile the code and make txtOuput.visible = false then the black screen issue comes back.  I have even tried recompiling with and without the text field visible several times as I was beginning to wonder if it was 'just' something non-deterministic in the compilation process but it does appear to be linked to the text field visibility.

This is obviously not ideal - I've resorted to setting txtOutput.visible = true; txtOutput.alpha = 0.01; and this does allow me to play videos all day long but strikes me as not being ideal.

Does anyone have any idea what this could be and how I should get round it?  I am wondering if it is some kind of timing issue and by ouputting text this slows things down just enough for whatever the problem is to disappear.  If there is an alternative to using stageVideo then at this point I would be very keen to try it because as everyone knows dealing with this kind of hard to find bug is just no fun!

This topic has been closed for replies.

1 reply

Leafcutter
Inspiring
October 16, 2013

I will try that.  Although the text overlay at 0.01 alpha seems to work very consistently and it isn't visible as at that alpha flash treats it as being on the display list but doesn't actually draw anything (or if it is drawing something it isn't visible to the naked eye).

I have tried a different approach where I create a new sprite, add it to the display list and then create the stage video entirely within that sprite.  When I want to show a new video I remove that sprite from the display list and then create an entirely new sprite with stage video.  This seems to work so I think that the issue is something to do with the display list and what is added and updated where.  I thought that stageVideo was entirely separate from the AIR display list but maybe there is a link there somewhere that it is possible to invalidate.

It is one of those very frustrating problems that has taken many hours of trying random things to find a workable solution and I am not convinced that it won't just stop working tomorrow!  I really just want a robust video object that I can stop, start, rewind, resize and chuck new videos at and it just works - I seem to be able to break stageVideo (or it stops working with an iOS update) with alarming ease!