Skip navigation
Currently Being Moderated

StageWebView.dispose() no longer functioning properly with iOS5?

Oct 27, 2011 10:20 PM

I'm playing a .mp4 video using StageWebView, Air 3.0 for iOS, iPad 2.

With the latest software version for the iPad2, when I dispose of the StageWebView instance, the .mp4 doesn't seem to close.

Well, at minimum the video's audio continues to play.

Anyone else encountered similar issues after the latest software update?

 
Replies
  • Currently Being Moderated
    Oct 28, 2011 1:50 AM   in reply to Donny1985

    Hi Donny1985,

    This is a bug, I am also able to see it on iPad 2, iOS 5. Could you please file a bug at http://bugbase.adobe.com and post the bug number here?

     

    Thanks,

    Sanika

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 3, 2011 12:02 PM   in reply to Donny1985

    I actually just came across this issue while creating an iPad app for a client.

     

    If you're still looking for a descent solution check out this article I just wrote at http://poopcode.com/playing-mp4-videos-in-the-native-ios-video-player- with-stagewebview/. It's a bit of a hack, but it gets the job done for now.

     

    Let me know if it works for you.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 3, 2011 1:26 PM   in reply to Donny1985

    You can consider a 3rd party helper like StageWebViewBridge which allows you to communicate with JavaScript in the StageWebView. Then you can tell JavaScript to properly dispose of the video and when done close your SWV.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 4, 2011 1:30 AM   in reply to sinious

    Hi,

    Update on the bug. It should be fixed in the next release of AIR.

     

    Thanks,

    Sanika

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 4, 2011 7:54 AM   in reply to sanika Kulshreshtha

    Any idea when that next air update will be? I've read forum rumors of them ditching StageWebView overall (inconceivable to me) and I'm hoping they'll both keep it and remove beta status from it. Works great for me.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 4, 2011 12:28 PM   in reply to Donny1985

    I am using stageWebView to play and mp4 my stageWebView variable is called webView so to kill it this line seems to work webView.stage = null;

     

    edit: I am in iOS 5 on iPad2 and iOS4 latest on iPhone 4, both work.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 5, 2011 8:43 AM   in reply to Mark.Raykhenberg

    I would still run a dispose() and null the object for garbage collection ala:

     

    webView.stage = null; // just make instantiated webview invisible, but still exists

    webView.dispose(); // run self destroying sequence, who knows what adobe does in this

    webView = null; // nullify reference marking for garbage collection

     

    Just taking it off the active stage won't destroy it until nothing references it. You could hope adobe accurately derefrences it if you do another webView = new StageWebView(); as long as webView's scope is the same as the prior, e.g. class variable..

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 6, 2011 4:04 PM   in reply to Donny1985

    Have you tried StageWebViewBridge? Javascript can certainly stop a html5 video.

     

    Regardless each page, as well as an onload handler, has an onunload handler. If you're embedding the video in a HTML5 page you might be able to fire off the onunload handler to make sure your video stops via JavaScript without StageWebViewBridge.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 7, 2011 7:10 AM   in reply to Donny1985

    I had the same issue, and then they implemented StageVideo, so I play it directly without a StageWebView. Why not just use that GPU accelerated class?

     

    My client wants an intro video to autoplay and I had to use StageWebViewBridge to talk to JavaScript after the page loaded to start the video automatically and it was a pain. Though Adobe has clearly stated not to use any items that are beta in a final product and at this moment StageWebView is marked Beta. Have you considered that?

     

    StageVideo is no longer beta.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 11, 2011 12:13 PM   in reply to Donny1985

    I believe it's not a bug. We need to dispose the object and have the garbage collection, set the StageWebView variable to null, so that we have no references to the actual StageWebView object.

     

    Try something like:


    stageWebView.reload();

    stageWebView.viewPort = null;

    stageWebView.dispose();

    stageWebView = null;

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 17, 2011 2:24 PM   in reply to Donny1985

    stageWebView.reload();

    stageWebView.viewPort = null;

    stageWebView.dispose();

    stageWebView = null;

     

    worked for me. Perfect! I still have a problem with StageVideo on my iPad 1 iOS 5. Audio plays fine but i see no video. So i will use WebView.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 17, 2011 2:40 PM   in reply to janwae2010

    I actually wrote about that here.  If you scroll down the comments there is an answer for the StageVideo API as well.

     

    The reason you are not seeing the video is most likely caused by it not being added to the display list.  The StageVideo object is actually behind all of the display objects on the stage unlike StageWebView which is displayed on top.  The trick is to house all of the objects on the stage inside of a containing sprite and hiding them all when the video is loaded.

     

    StageVideo is really supposed to be used as a video player allowing you to place the controls on top.

     

    @Gabriel - Glad to see it worked for you!

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 22, 2011 8:03 AM   in reply to sanika Kulshreshtha

    Any idea when this will be fixed? or a solution provided?

     

    Thanks

    MR

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 23, 2011 10:50 AM   in reply to MR9

    Did you checked AIR 3.1 ? It is fixed in there.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 24, 2011 9:38 AM   in reply to meetshah4288

    The update fixed the problem but broke the ipa filename, but I am able to work around that. Thanks!

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 9, 2011 8:47 AM   in reply to Gabriel Peart

    stageWebView.reload();

    stageWebView.viewPort = null;

    stageWebView.dispose();

    stageWebView = null;

     

     

    This works perfectly for me...   Only problem is that now since I kill the webView .. I can't re-open it again.     How can I get around this ?

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 9, 2011 9:24 AM   in reply to Applauz78

    If you don't need to kill it (in other words, desire to have it continue to exist to reopen) why are you killing it? If you just want to hide it set the .stage property to null and it will disappear. Although if media is playing in it you may hear it. In that case you'd need to dispose and null which stops all movies just fine for me.

     

    The stageWebView.reload(); is not necessary, perhaps due to 3.1. I never needed this with 3.0 either however.

     

    If you want to use the same webview (class-level variable?) just stageWebView = new StagWebView(); and set the stage, viewPort and load something in it. If you null it you need to completely remake it. I re-use a class level variable to reference the same webview all the time. Works fine.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 9, 2011 9:36 AM   in reply to sinious

    If I remove the .reload() the video's audio continues to play when it's removed. 

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 9, 2011 11:08 AM   in reply to Applauz78

    Are you loading a .html page or are you loading a video directly in there? I load it directly in the UIWebView so it auto-plays. Perhaps that's the difference.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 9, 2011 11:12 AM   in reply to sinious

    I'm loading the video directly..

     

    var path = "file://"+docs.nativePath+"/video.mp4" as String;

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 9, 2011 11:53 AM   in reply to Applauz78

    I just do:

     

    var sFileName:String = 'assets/video/some.mp4';

    var rVideoFile:File = File.applicationDirectory.resolvePath(sFileName);

    if (rVideoFile.exists)

    {

      _stageWebView = new StageWebView();

      _stageWebView.stage = this.stage;

      _stageWebView.viewPort = new Rectangle(x, x, x, x); // predetermined with baked in assets

      _stageWebView.loadURL(rVideoFile.nativePath);

    }

     

    When I need to get rid of the video I do the code I've mentioned several times..

     

    _stageWebView.stage = null;

    _stageWebView.viewPort = null;

    _stageWebView.dispose();

    _stageWebView = null;

     

    Video or audio stops playing just fine. Also autoplays upon launching.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 13, 2012 1:20 PM   in reply to Donny1985

    I got the video playing, but the "done" button on the native player closes the video and gets back to the StageWebView, how do I close it and get back to my application?

     

    is it with the Event.COMPLETE? does not work, it's not distached

     

    view = new StageWebView();

    view.addEventListener(Event.COMPLETE,handleLoad);

    view.stage = this.stage;

    view.viewPort = new Rectangle( x, y, 320, 480);

    view.loadURL(path);

     

    function handleLoad(event : Event) : void

    {

                                  view.reload();

                                  view.viewPort = null;

                                  view.dispose();

                                  view = null;

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 15, 2012 5:29 AM   in reply to Christian Pugliese

    You can't communicate with StageWebView. There's no easy way unless you have an native extension to utilize native iOS UIWebView. There's a UIWebView and VideoPlayer native extension available at http://darkredz.com/introducing-ios-uiwebview-and-videoplayer-native-e xtension-for-air-mobile/

     

    You can listen on full screen exit event and dispose the video player from there.

    http://darkredz.com/ane/UIWebView/apidoc/com/darkredz/mobile/ane/Video Player.html#event:fullscreenExit

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points