Thibault Sébastien
Guest
|
Posted:
Tue Aug 31, 2004 9:56 pm Post subject:
comment faire un suivi de video media player |
|
|
J'aimerais savoir avec du code à quel endroit ma video est rendu.
J'utilise ceci comme video
<OBJECT
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="320"
height="240" align="middle" ID="WMPEmbed">
<PARAM name="autoStart" value="true">
<PARAM name="UIMode" value="full">
<PARAM name="URL"
value="cafcab.asx">
<EMBED
SRC="cafcab.asx"
WIDTH=320
HEIGHT=240 align="middle" TYPE="application/x-mplayer2"
NAME="MediaPlayer"> </EMBED> </OBJECT>
mais il faut que je sache quand la video est entrain de jouer, à quel moment
il reste 10,20-30 %.
Je veux savoir ça pour envoyer un message à l'utilisateur.
Avec un REALPlayer, je fais ceci
***************************************************
Sub RVOCX_OnPresentationClosed(myPos)
call sendToClose(myPos)
End Sub
Sub RVOCX_OnPositionChange(myPos, myLen)
if document.RVOCX.getplaystate() <> 5 then
un_cinq = mylen / 5
deux_cinq = un_cinq * 2
trois_cinq = un_cinq * 3
quatre_cinq = un_cinq * 4
if document.RVOCX.getplaystate() = 4 or document.RVOCX.getplaystate() = 0
then
call sendTimePosition()
end if
if myPos > un_cinq and myPos < deux_cinq then
call sendfin(1)
end if
if myPos > deux_cinq and myPos < trois_cinq then
call sendfin(2)
end if
if myPos > trois_cinq and myPos < quatre_cinq then
call sendfin(3)
end if
if myPos > quatre_cinq then
call sendfin(4)
end if
if myPos > (myLen - 10000) then
call sendToShockwave("fin")
end if
end if
End Sub
***********************************************
MAIS avec un media player, je ne sais pas comment faire.
|
|
Cédric HULARD
Guest
|
Posted:
Thu Sep 09, 2004 1:21 am Post subject:
RE: comment faire un suivi de video media player |
|
|
J'ai eu le mĂȘme problĂšme recemment.
Le OnPositionChange présenté par le player n'est déclenché que lorsque
l'utilisateur change lui-mĂȘme la position. Donc pas de notification quand le
player est en mode lecture et qu'on n'y touche pas
En javascript, Player étant l'id de la balise object du player
<script FOR="Player" EVENT="OnPositionChange( newPosition )>
mes fonctions...
</script>
Ensuite, pour le fonctionneemnt normal, je n'ai pas trouvé mieux qu'un timer
qui se réveille toutes les 100 ms pour executer une fonction
window.setInterval( "maFonction();", 100 ); permet de le réaliser
Dans maFonction(), document.getElementById( 'Player'
).controls.currentPosition permet de récupérer la position courante dans le
média en cours
Céd
"Thibault Sébastien" wrote:
| Quote: | J'aimerais savoir avec du code Ă quel endroit ma video est rendu.
J'utilise ceci comme video
OBJECT
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="320"
height="240" align="middle" ID="WMPEmbed"
PARAM name="autoStart" value="true"
PARAM name="UIMode" value="full"
PARAM name="URL"
value="cafcab.asx"
EMBED
SRC="cafcab.asx"
WIDTH=320
HEIGHT=240 align="middle" TYPE="application/x-mplayer2"
NAME="MediaPlayer"> </EMBED> </OBJECT
mais il faut que je sache quand la video est entrain de jouer, Ă quel moment
il reste 10,20-30 %.
Je veux savoir ça pour envoyer un message à l'utilisateur.
Avec un REALPlayer, je fais ceci
***************************************************
Sub RVOCX_OnPresentationClosed(myPos)
call sendToClose(myPos)
End Sub
Sub RVOCX_OnPositionChange(myPos, myLen)
if document.RVOCX.getplaystate() <> 5 then
un_cinq = mylen / 5
deux_cinq = un_cinq * 2
trois_cinq = un_cinq * 3
quatre_cinq = un_cinq * 4
if document.RVOCX.getplaystate() = 4 or document.RVOCX.getplaystate() = 0
then
call sendTimePosition()
end if
if myPos > un_cinq and myPos < deux_cinq then
call sendfin(1)
end if
if myPos > deux_cinq and myPos < trois_cinq then
call sendfin(2)
end if
if myPos > trois_cinq and myPos < quatre_cinq then
call sendfin(3)
end if
if myPos > quatre_cinq then
call sendfin(4)
end if
if myPos > (myLen - 10000) then
call sendToShockwave("fin")
end if
end if
End Sub
***********************************************
MAIS avec un media player, je ne sais pas comment faire.
|
|
|