0

I open a video to play in the StageWebView:

  var webView:StageWebView = new StageWebView();
   var path:String = 'http://www.winterlife.com/files/apps/zhdk/test.mp4';
   webView.stage = this.stage;
   webView.viewPort = new Rectangle( x, y, width, height);
   webView.loadURL(path);

This works fine, video starts playing.

Question 1: If I want to close the StageWebVideo, I touch "Done/Close". But nothing happens, except the video stops. (I want to close the video player and go back to my app.)

Question 2: How can I set the video to autoplay?

Question 3: When I start StageWebView, a white background appears for some short time. What is that, and how can I avoid it.

Thank you very much!

nbuechi
  • 229
  • 4
  • 20
  • I just tested it on a iPhone 4. When I hit Done/Close, it shrinks from fullscreen to a smaller window. How can I capture that closing event, so I can dispose the StageWebView. This belongs to Q1. – nbuechi May 08 '14 at 13:21

2 Answers2

1

You have zero control over the video player in StageWebView by default. No events, no auto-play, nothing. What you want to do is simply not possible using that component.

You have two options:

  1. Use a replacement ANE that mimics the functionality and gives you access to the things you want. UIWebView from Darkredz may be a possible substitute, though I haven't used it in 18 months, it hasn't been updated in 12, and it's not free.
  2. Use StageVideo and build your own player around it. This is my preferred method. It still uses the native video player, but gives you great control over the video and a plethora of events to listen for. Plus you can design your own controls for it.
Josh
  • 8,079
  • 3
  • 24
  • 49
  • I'm not sure, if you understood my first question. I've seen code like this "function handleLoad(event : Event) : void { view.reload(); view.viewPort = null; view.dispose(); view = null; }" many time, but I do not understand how to implement it. – nbuechi May 08 '14 at 20:44
  • @nbuechi I understood it perfectly. You can't control the content of `StageWebView`, as I said. The component itself gives off general events, but you cannot listen for any events regarding the content, beyond a load or error. There is no event for video close that you have access to. As stated in my answer, what you want is not possible with the default `StageWebView` component. Period. – Josh May 10 '14 at 11:25
  • Does this mean, if I open a Video with StageWebView, it will stay open forever, and there is no possibility to go back to my App? – nbuechi May 11 '14 at 15:09
  • No. You simply dispose the StageWebView object. – Josh May 11 '14 at 15:40
1

You can close the native video player by adding StageWebView in the popup container with a close button. Because, .mp4 is not supported flex video player in ios, instead of this we use native player to play the video.

While we use StageWebView it automatically take Native player in IOS. So we can add StageWebView in a popup container with a custom close button for dispose() StageWebView and close the popup container. By this method we can close our native video player in IOS.

StageWebView is always open in top of our application, when you click the link, the popup will open in top of the application, and stagewebview also will open in top of the application. You can modify the viewPort for adding close button.