Solved

getting an flv to PLAY to a certain point not SEEK to a certain point

Posted on 2007-11-23
4
218 Views
Last Modified: 2010-05-18
Hello, can someone give me some sample code on how to get an flv to play to a certain point when one button is clicked and then play to another point when another is clicked etc...

Cheers
0
Comment
Question by:Sideas
  • 2
  • 2
4 Comments
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 20340209
If you are using FLVPlayback component then it is easily achievable using FLVPlaybackInstancename.seekSeconds("enter value in seconds here");

below is code showing how an FLV can be playback directly from 4 second position after loading.

/**

 Requires:

  - FLVPlayback component on the Stage with an instance name of my_FLVPlybk

*/

import mx.video.*;

my_FLVPlybk.autoPlay = false;

var listenerObject:Object = new Object();

listenerObject.ready = function(eventObject:Object):Void {

    my_FLVPlybk.seekSeconds(4);

    my_FLVPlybk.play();

};

my_FLVPlybk.addEventListener("ready", listenerObject);

my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";

Open in new window

0
 
LVL 2

Author Comment

by:Sideas
ID: 20340301
Cheers for the quick answer, but I mean FROM 0 seconds TO 4 seconds, not from 4 seconds onwards...
I dunno if I'm explaining it too well!
0
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 500 total points
ID: 20340329
then you need to use cuePoint event of FLVPlayback component

here is the sample code:
/**

 Requires:

  - FLVPlayback component on the Stage with an instance name of my_FLVPlybk

*/

import mx.video.*;

my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";

// create cue point object

var cuePt:Object = new Object(); //create cue point object

cuePt.time = 4;

cuePt.name = "end_time";

cuePt.type = "actionscript";

my_FLVPlybk.addASCuePoint(cuePt);  //add AS cue point
 

var listenerObject:Object = new Object();

listenerObject.cuePoint = function(eventObject:Object):Void {
 

        if(eventObject.info.name == "end_time")

        {

             my_FLVPlybk.stop();   

        }

}

my_FLVPlybk.addEventListener("cuePoint", listenerObject);

Open in new window

0
 
LVL 2

Author Closing Comment

by:Sideas
ID: 31410692
Superb, thank you so much!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now