Précédent   Forum du club des développeurs et IT Pro > Autres langages > Pascal > Flash Pascal
Flash Pascal Forum d'entraide sur la création de fichiers Flash en Object Pascal
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 22/07/2012, 16h11   #1
Archimède
Membre émérite
 
Avatar de Archimède
 
Homme anthony
Enseignant
Inscription : avril 2005
Messages : 1 023
Détails du profil
Informations personnelles :
Nom : Homme anthony
Localisation : France, Charente Maritime (Poitou Charente)

Informations professionnelles :
Activité : Enseignant
Secteur : Enseignement

Informations forums :
Inscription : avril 2005
Messages : 1 023
Points : 975
Points : 975
Par défaut Image par image sur vidéo

Hello, de retour pour quelques jours...

J'ai cherché à contrôler la lecture d'une video...

ci-joint :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
 
Unit UVideoButton;
interface
 
uses Flash8;
 
type
  TButton=class(movieClip)
   Private
    w,h,fonction:number;
    procedure skin;
    procedure skin1playpause;
    procedure skin2stop;
    procedure skin3back;
    procedure skin4up;
   Public
    skin1,Skin2:movieclip;
    procedure onPress;override;
    procedure onClick;virtual;
    Constructor Create(parent:movieclip;nbskin,left,top,width,height:number);
  end;
 
implementation
 
Constructor TButton.Create(parent:movieclip;nbskin,left,top,width,height:number);
begin
  inherited Create(parent,'button', movieclip(parent).getNextHighestDepth());
  w:=width;
  h:=height;
  fonction:=nbskin;
  linestyle(3,$e0e0e0);
  BeginFill($c0c0c0);
  moveto(0,h);
  lineto(0,0);
  lineto(w,0);
  linestyle(3,$808080);
  lineto(w,h);
  lineto(0,h);
  skin;
  _x:=left;
  _y:=top;
end;
 
Procedure TButton. skin1playpause;
begin
  skin1:=movieclip.Create(self,'skin1',1);
  skin2:=movieclip.Create(self,'skin2',2);
  With skin1 do
  begin
   BeginFill(clBlack);
   linestyle(2,clBlack);
   moveto(w/4,h/4);
   lineto(3*w/4,h/2);
   lineto(w/4,3*h/4);
  end;
  With skin2 do
  begin
   linestyle(6,clBlack);
   moveto(7*w/20,h/4);
   lineto(7*w/20,3*h/4);
   moveto(13*w/20,h/4);
   lineto(13*w/20,3*h/4);
   _visible:=false;
  end;
end;
 
Procedure TButton. skin2stop;
begin
  BeginFill(clBlack);
  linestyle(2,clBlack);
  moveto(w/4,h/4);
  lineto(3*w/4,h/4);
  lineto(3*w/4,3*h/4);
  lineto(w/4,3*h/4);
  lineto(w/4,h/4);
end;
 
procedure TButton.skin3back;
begin
  linestyle(4,clBlack);
  moveto(3*w/4,h/4);
  Lineto(w/4,h/2);
  moveto(w/4,h/2);
  Lineto(3*w/4,3*h/4);
end;
 
procedure TButton.skin4up;
begin
 linestyle(4,clBlack);
 moveto(w/4,h/4);
 Lineto(3*w/4,h/2);
 moveto(3*w/4,h/2);
 Lineto(w/4,3*h/4);
end;
 
procedure TButton.skin;
begin
 case fonction of
  1:skin1playpause;
  2:skin2stop;
  3:skin3back;
  4:skin4up;
 end;
end;
 
procedure TButton.onClick;
begin
end;
 
procedure TButton.onPress;
begin
 onClick;
end;
 
end.

Le programme :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
 
program PVideo;
 
uses
  Flash8,UVideoButton;
 
{$FRAME_WIDTH 640}
{$FRAME_HEIGHT 380}
{$BACKGROUND $9999ff}
{$FRAME_RATE 32}
 
// Flash 8 ne permet pas d'instancier l'objet Video par programme
// la directive de compilation $VIDEO permet contourner ce problème
// l'objet est créé statiquement avant le lancement du programme
// il ne reste plus qu'à déclarer une variable "external" pour l'utiliser.
{$VIDEO name="my_video" depth="1" left="0" top="0" width="320" height="240"}
 
(* syntaxe plus compacte équivalement
  {$VIDEO my_video 1 0 20 180 180}
*)
 
type
 
  MyNetStream = class(NetStream)
    procedure onStatus(infoObject: TInfoObject); override;
  end;
 
  MyScreen=class
   btplay,btstop,btback,btNext:TButton;
   constructor Create;
   procedure onPlay(sender:TObject);
   procedure onStop(sender:TObject);
   procedure onBackframe(sender:TObject);
   procedure onNextFrame(sender:TObject);
  end;
 
 
var
  nc: NetConnection;
  ns: MyNetStream;
  vo: Video external 'my_video';
 
Constructor MyScreen.Create;
begin
 btplay:=TButton.Create(_Root,1,10,10,50,50);
 btstop:=TButton.Create(_Root,2,10,70,50,50);
 btback:=TButton.Create(_Root,3,10,130,50,50);
 btNext:=TButton.Create(_Root,4,10,190,50,50);
 
 nc := NetConnection.Create;
 nc.connect(nil);
 ns := MyNetStream.Create(nc);
 vo.attachVideo(ns);
 vo._height:=stage.height;
 
 with vo do
 begin
  _width:=320*_height/240;
  _x:=(stage.width-_width)/2;
  smoothing:=true;
 end;
 
 ns.play('Execute.re.flv');
 ns.pause;
 
 btplay.onClick:=onPlay;
 btStop.onClick:=onStop;
 btBack.onClick:=onBackframe;
 btNext.onClick:=onNextframe;
end;
 
procedure MyScreen.onPlay(sender:TObject);
begin
 with btplay.skin1 do _visible:=not _visible;
 with btplay.skin2 do _visible:=not _visible;
 ns.pause;
end;
 
procedure MyScreen.onStop(sender:TObject);
begin
 btplay.skin1._visible:=true;
 btplay.skin2._visible:=false;
 ns.play('Execute.re.flv');
 ns.pause;
end;
 
procedure MyScreen.onBackframe(sender:TObject);
begin
  with ns do seek(time-1/currentFps);  //ici à la frame précédente
end;
 
procedure MyScreen.onNextFrame(sender:TObject);
begin
  with ns do seek(time+1/currentFps);// Je devrais passer à chaque fois à la frame suivante !   Time+1/10
end;
 
procedure MyNetStream.onStatus(infoObject: TInfoObject);
begin
  if infoObject.code = 'NetStream.Buffer.Empty' then ns.play('Excute.re.flv') ;
end;
 
 
begin
 MyScreen.Create;
end.
En fait, j'aimerais pouvoir contrôler l'image par image avec les deux derniers boutons et je ne vois pas comment faire...

merci

anthony
__________________
Citation:
tout développeur plongé dans son code subit une poussée d'urticaire de bas en haut égale au poids du volume d'unités qu'il ajoute.
Archimède est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 23/07/2012, 06h34   #2
Paul TOTH
Expert Confirmé Sénior
 
Avatar de Paul TOTH
 
Homme Paul TOTH
Freelance
Inscription : novembre 2002
Messages : 4 393
Détails du profil
Informations personnelles :
Nom : Homme Paul TOTH
Âge : 43
Localisation : Réunion

Informations professionnelles :
Activité : Freelance
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : novembre 2002
Messages : 4 393
Points : 10 728
Points : 10 728
Hello,

belle démo, je pense que tu as fais tout ce qu'il fallait...mais ça ne fonctionne pas...même si je fais un seek(0.1) il part à 16.015 secondes. En fait seul le seek(0) fonctionne.

j'ai vu d'autres personnes ayant un problème de seek sur un FLV local mais aucune réponse :S
http://www.kirupa.com/forum/showthre...g-FLVs-locally
__________________
Developpez.com: Mes articles, forum FlashPascal
Entreprise: Execute SARL
Produits : UPnP, RemoteOffice, FlashPascal
Embarcadero : Ile de la Réunion, Dephi, C++Builder, RADPHP...TVA à 8,5%
Paul TOTH est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 23/07/2012, 09h56   #3
Archimède
Membre émérite
 
Avatar de Archimède
 
Homme anthony
Enseignant
Inscription : avril 2005
Messages : 1 023
Détails du profil
Informations personnelles :
Nom : Homme anthony
Localisation : France, Charente Maritime (Poitou Charente)

Informations professionnelles :
Activité : Enseignant
Secteur : Enseignement

Informations forums :
Inscription : avril 2005
Messages : 1 023
Points : 975
Points : 975
Hello,

merci pour ton lien...en effet, il y a un problème avec seek()...
C'est faisable pourtant...
ci-joint un exemple en pièce jointe...

a+
Fichiers attachés
Type de fichier : swf propag_eau.swf (73,3 Ko, 4 affichages)
__________________
Citation:
tout développeur plongé dans son code subit une poussée d'urticaire de bas en haut égale au poids du volume d'unités qu'il ajoute.
Archimède est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 23/07/2012, 13h55   #4
Paul TOTH
Expert Confirmé Sénior
 
Avatar de Paul TOTH
 
Homme Paul TOTH
Freelance
Inscription : novembre 2002
Messages : 4 393
Détails du profil
Informations personnelles :
Nom : Homme Paul TOTH
Âge : 43
Localisation : Réunion

Informations professionnelles :
Activité : Freelance
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : novembre 2002
Messages : 4 393
Points : 10 728
Points : 10 728
oui, par contre c'est un principe différent qui est utilisé.

la vidéo est intégrée au SWF et attachée à un Sprite comprenant 15 frames, le bouton "Suivant" fait simplement un Sprite.gotoAndPlay((Sprite._currentFrame + 1) mod 15).

Je ne sais pas s'il est possible de reproduire cela avec une vidéo externe...ni même comment on reproduit ça dans Flash
__________________
Developpez.com: Mes articles, forum FlashPascal
Entreprise: Execute SARL
Produits : UPnP, RemoteOffice, FlashPascal
Embarcadero : Ile de la Réunion, Dephi, C++Builder, RADPHP...TVA à 8,5%
Paul TOTH est déconnecté   Envoyer un message privé Réponse avec citation 20
Vieux 23/07/2012, 14h14   #5
Archimède
Membre émérite
 
Avatar de Archimède
 
Homme anthony
Enseignant
Inscription : avril 2005
Messages : 1 023
Détails du profil
Informations personnelles :
Nom : Homme anthony
Localisation : France, Charente Maritime (Poitou Charente)

Informations professionnelles :
Activité : Enseignant
Secteur : Enseignement

Informations forums :
Inscription : avril 2005
Messages : 1 023
Points : 975
Points : 975
Citation:
Envoyé par Paul TOTH Voir le message
le bouton "Suivant" fait simplement un Sprite.gotoAndPlay((Sprite._currentFrame + 1) mod 15).
Impressionnant de précision...

Dommage, c'était très intéressant... tant pis.

merci pour ton regard d'expert
__________________
Citation:
tout développeur plongé dans son code subit une poussée d'urticaire de bas en haut égale au poids du volume d'unités qu'il ajoute.
Archimède est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 05h15.


 
 
 
 
Partenaires

Hébergement Web