Skip to main content
Participating Frequently
June 3, 2011
Question

Playing video with StageWebView, how to stop video (without timer)?

  • June 3, 2011
  • 2 replies
  • 1717 views

I am using StageWebView to play some video's on a different (numbered) frame, and as of now they only way I can figure out how to kill the video and return to the previous frame is by using a timer to go back after a given amount of time.  This is a bit of a hack, and not optimal, since I want users to be able to stop the video and go back at any time if they choose to.  Any ideas?

Here's the code I currently have on the frame with the video...

import flash.geom.Rectangle;

import flash.media.StageWebView;

import flash.filesystem.File;


stop();

//Timer to next frame

var myTimer1:Timer = new Timer(48000);

myTimer1.addEventListener(TimerEvent.TIMER, fortyeightSec);

myTimer1.start();

function fortyeightSec(event:TimerEvent):void

{

webView1.stage = null;

myTimer1.stop();

MovieClip(root).gotoAndStop(4);

}


//Video Play

var webView1:StageWebView = new StageWebView();

webView1.stage = this.stage;

webView1.viewPort = new Rectangle(0,0,stage.stageWidth,stage.stageHeight);

var fPath1:String = new File(new File("app:/objects.mp4").nativePath).url;

webView1.loadURL( fPath1 );

This topic has been closed for replies.

2 replies

relaxatraja
Inspiring
June 7, 2011

The code will load the video within the stagewebview port but doesn't have the support the controls, becoz itz playing with the native player support. So that you decided to use the timer according the timing of the video and send back by making the view to null. If you want to use without timers, you really need to work with flvcomponent playback with script controls.

Using H.264 video with flvComponent:

http://blog.six4rty.ch/tutorials/flash-cs3-play-h264-video-using-the-flvplayback-component/

Known Participant
June 7, 2011

Have you tried the FLVPlayback component on an iPad?  I could not get it to work.

Colin Holgate
Inspiring
June 7, 2011

The FLVPlayback component won't play H.264 on iOS. It does play FLV well, but it can't use the usual controller swf, set the controller to None. You can use the individual components though, such as the Play/Pause button.

Known Participant
June 6, 2011

I wish you luck getting any support for this.