[flash actionscript] videoplayer netstream fastforward

Pagina: 1
Acties:

  • edwinistrator
  • Registratie: December 2000
  • Laatst online: 23-03-2022
Ik heb een flv player gemaakt, maar nu wil ik een fast-forward button. Als de button ingedrukt is moet de video snelworden afgespeeld. Met de code die ik nu heb springt de video 1 sec. vooruit on onpress.


code:
1
2
3
forwardButton.onPress = function() {
    ns.seek(ns.time+1);
};

Zo'n functie als deze maar dan die op de flv werkt en niet op een ingeladen swf :/
code:
1
2
3
4
5
on (press) {
    movieHolder.onEnterFrame = function () {
        movieHolder.gotoAndStop(movieHolder._currentframe + 5);
    };
}

iemand een idee?

[ Voor 4% gewijzigd door edwinistrator op 23-02-2006 20:11 ]


  • Murphy
  • Registratie: November 2000
  • Laatst online: 23-03 16:20

Murphy

(2B||!2B)?

Je hebt de onEnterFrame aan de movieHolder gehangen, misschien dat je daarom _currentframe + 5 zonder movieHolder. moet doen?

  • XangadiX
  • Registratie: Oktober 2000
  • Laatst online: 25-03 10:55

XangadiX

trepanatie is zóó kinderachtig

nee, flv is fundementeel iets anders dan een swf. Het is een stream. probeer eens iets als ns.seek
NetStream.seek()
Availability
Flash Player 7.

Note: This method is also supported in Flash Player 6 when used with Flash Communication Server. For more information, see the Flash Communication Server documentation.

Usage
my_ns.seek(numberOfSeconds:Number) : Void

Parameters
numberOfSeconds The approximate time value, in seconds, to move to in an FLV file. The playhead moves to the keyframe of the video that’s closest to numberOfSeconds.

To return to the beginning of the stream, pass 0 for numberOfSeconds.
To seek forward from the beginning of the stream, pass the number of seconds you want to advance. For example, to position the playhead at 15 seconds from the beginning, use my_ns.seek(15).
To seek relative to the current position, pass my_ns.time + n or my_ns.time - n to seek n seconds forward or backward, respectively, from the current position. For example, to rewind 20 seconds from the current position, use my_ns.seek(my_ns.time - 20).
The precise location to which a video seeks will differ depending on the frames per second setting at which it was exported. Therefore, if the same video is exported at 6 fps and 30 fps, it will seek to two different locations if you use, for example, my_ns.seek(15) for both video objects.

Returns
Nothing.

Description
Method; seeks the keyframe closest to the specified number of seconds from the beginning of the stream. The stream resumes playing when it reaches the specified location in the stream.

Example
The following example illustrates some ways to use the NetStream.seek() command:

// Return to the beginning of the stream
my_ns.seek(0);

// Move to a location 30 seconds from the beginning of the stream
my_ns.seek(30);

// Move backwards three minutes from current location
my_ns.seek(my_ns.time - 180);

See also
NetStream.play(), NetStream.time
Actionscript dictionary

Stoer; Marduq


  • Murphy
  • Registratie: November 2000
  • Laatst online: 23-03 16:20

Murphy

(2B||!2B)?

auhw, ik dacht dat je juist bedoelde dat je onderste code niet werkte |:(

  • edwinistrator
  • Registratie: December 2000
  • Laatst online: 23-03-2022
XangadiX schreef op vrijdag 24 februari 2006 @ 03:49:
...probeer eens iets als ns.seek...
ja, was al met de ns.seek bezig geweest (zie vorige post 1e code)
code:
1
2
3
forwardButton.onPress = function() {
    ns.seek(ns.time+1);
};

Maar dan verspringt de flv in eens een aantal seconden, ik wil vooruit en achteruit kunnen 'spoelen' als het ware.

Verwijderd

moet je dan dit niet gewoon onmousedown doen?

  • sanderb
  • Registratie: November 2000
  • Laatst online: 08:28
onPress wordt eenmalig uitgevoerd. Wat je kan doen is onPress een functie starten met een interval. Dan wordt die functie elke (in dit geval) 40 ms uitgevoerd.
onRelease stop je het interval door clearInterval.
Ik weet niet of dit zo zou werken met een netstream. Theoretisch zou je nu zolang je knop ingedrukt houdt telkens de stream een stukje verder zetten. dat stukje is afhankelijk in onderstaand voorbeeld van seekSpeed.
Door die te varieren kun je dus sneller of langzamer spoelen. (of negatief om terug te spoelen)
Bovendien is het dus ook afhankelijk van de snelheid van je interval (in onderstaand voorbeeld elke 40 ms)

Hou er overigens rekening mee dat de stream sowieso al zover binnen moet zijn dat je uberhaupt kan spoelen..

niet getest!:
Flash ActionScript:
1
2
3
4
5
6
7
8
9
10
11
12
13
var seekSpeed:Number = 5;

fastForwardSeek = function(){
ns.seek(ns.time+seekSpeed);
}

ffwButton.onPress =  function(){
 seekInterval = setInterval(fastForwardSeek, 40);
}

ffwButton.onRelease = function(){
clearInterval(seekInterval );
}

" A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. " - Douglas Noel Adams

Pagina: 1