Jump to content


I can't play video while loading

Recommended Posts


a can't play the videoLoader while the video is loading.


I have something like this


var video:VideoLoader;

var src:String = "video/mVideo.mp4";

var thisCache:Boolean = true;

var thisWidth:Number 800;

var thisHeight:Number = 600;

var estimatedBytes:Number = 75000;

video = new VideoLoader(src,{name:"video",container:this,autoPlay:false,noCache:thisCache,
scaleMode: "proportionalInside",
The "on" functions are very simple functions.
 Well, when i try to play the video with "ideo.playVideo()" it doesn't start before the video is completely loaded.
Where do i wrong? Could you help me?
Thank you on advance and best regards.
Link to comment
Share on other sites

Also in your example the video doesn't start before the video is not completely downloaded.


import com.greensock.loading.*;
import com.greensock.loading.display.*;
import com.greensock.*;
import com.greensock.events.LoaderEvent;
//create a VideoLoader
var video: VideoLoader = new VideoLoader("http://www.attivitacollaterali.it/carife/video/fe1_flash.mp4", {
name: "myVideo",
container: this,
noCache: true,
width: 400,
height: 300,
scaleMode: "proportionalInside",
bgColor: 0x000000,
autoPlay: false,
volume: 0,
requireWithRoot: this.root,
estimatedBytes: 75000
//start loading
//add a CLICK listener to a button that causes the video to toggle its paused state.
button.addEventListener(MouseEvent.CLICK, togglePause);
function togglePause(event: MouseEvent): void {
video.videoPaused = !video.videoPaused;
//or you could put the VideoLoader into a LoaderMax queue. Create one first...
var queue: LoaderMax = new LoaderMax({
name: "mainQueue",
onProgress: progressHandler,
onComplete: completeHandler,
onError: errorHandler
//append the VideoLoader and several other loaders
//queue.append( new DataLoader("assets/data.txt", {name:"myText"}) );
//queue.append( new ImageLoader("assets/image1.png", {name:"myImage", estimatedBytes:3500}) );
//start loading the LoaderMax queue
function progressHandler(event: LoaderEvent): void {
trace("progress: " + event.target.progress);
function completeHandler(event: LoaderEvent): void {
//play the video
//tween the volume up to 1 over the course of 2 seconds.
TweenLite.to(video, 2, {
volume: 1
function errorHandler(event: LoaderEvent): void {
trace("error occured with " + event.target + ": " + event.text);
Note that in both post the cache value is true.
Link to comment
Share on other sites

Sorry I can't replicate that in my simple test file:




In this example autoPlay is set to false and once the 2-second buffer is full the video will play when you click, which triggers video.playVideo() (even before the entire video is downloaded)


Here is the very basic code I am using:


import com.greensock.*;
import com.greensock.loading.VideoLoader;
import com.greensock.events.LoaderEvent;
import flash.events.MouseEvent;

var isActive:Boolean = false;

var video:VideoLoader = new VideoLoader("videoClip03.flv", {container:this, autoPlay:false, onProgress:onProgress, bufferTime:2, noCache:true})

function onProgress(e:LoaderEvent):void {
    total_mc.scaleX = video.progress;
buffer_mc.scaleX = video.bufferProgress;


stage.addEventListener(MouseEvent.CLICK, playVid)

function playVid(e:MouseEvent):void {

Also, you'll note in the docs example that you are using that autoPlay is set to false which will prevent it from playing. It is told to start playing in the onComplete callback.


If you need more help please provide a simple and complete example we can test.

Link to comment
Share on other sites

Thank you,

Yesterday night i solved the problem.

Changing the source file from mp4 to flv everything works.

That mp4 was without (or the program didn't find) the metadata (the server has mp4 mime).

Maybe there are any problems using mp4?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.