Solved

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

Posted on 2007-11-23
4
224 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

636 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