Solved

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

Posted on 2007-11-23
4
219 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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can't find all of the preferences on Flash Pro 2 488
Video sharing with user login 3 205
flash in chrome 4 101
IE11 stops playing video on a certain website 10 79
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…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

831 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