-------- Message transféré --------
Sujet : [Gambas Bug Tracker] Bug #1154: MediaPipeline.position
Date : Mon, 28 Aug 2017 17:04:39 GMT
De : bugtrac...@gambaswiki.org
Pour : joir2...@hotmail.com, g4m...@gmail.com

http://gambaswiki.org/bugtracker/edit?object=BUG.1154&from=L21haW4-

Comment #5 by Joris ALDERS:

Is there a way i can upload the project?



Public ClockTimer As Timer
Public PositionTimer As Timer
Public Frames As Integer
Public PreviousSeconds As Integer
Public VideoFile As String
Public $hhPlayer As MediaPlayer
Public hSink As MediaControl

Public Sub InitTimer_Timer()
 InitTimer.enabled = False
Dialog.path = "." Try $hhPlayer = New Mediaplayer As "MediaPlayer"
 Try hSink = New MediaControl($hhPlayer, "ximagesink")
 Try hSink.SetWindow(VideoDisplay, VideoDisplay.X, VideoDisplay.Y, 640, 360)
 Try $hhPlayer.Video.output = hSink
 If Error Then Print Error.text

 ClockTimer = New Timer As "ClockTimer"
 ClockTimer.delay = 40
 ClockTimer.enabled = True
PositionTimer = New Timer As "PositionTimer"
 PositionTimer.delay = 40
 PositionTimer.enabled = True
End

Public Sub ClockTimer_Timer()
 If PreviousSeconds <> Str$(Second(Now)) Then Frames = 0
ClockDisplay.text = Str$(Hour(Now)) & ":" If Len(Str$(Minute(Now))) = 1 Then ClockDisplay.text = ClockDisplay.text & "0" ClockDisplay.text = ClockDisplay.Text & Str$(Minute(Now)) & ":" If Len(Str$(Second(Now))) = 1 Then ClockDisplay.text = ClockDisplay.text & "0"
 ClockDisplay.text = ClockDisplay.Text & Str$(Second(Now)) & ":"
 If Len(Str$(frames)) = 1 Then ClockDisplay.text = ClockDisplay.text & "0"
 ClockDisplay.text = ClockDisplay.text & Str$(Frames)
 PreviousSeconds = Str$(Second(Now))
 Frames = Frames + 1
End


Public Sub OpenButton_Click()
 If Dialog.OpenFile(False) Then Return
 VideoFile = Dialog.path
 Print VideoFile
 Try $hhPlayer.url = Media.URL(VideoFile)
 Try hSink.SetWindow(VideoDisplay, VideoDisplay.X, VideoDisplay.Y, 640, 360)
 If Error Then
   PlayButton.enabled = False
StopButton.enabled = False Print Error.Text Message.Error(Error.text, "OK") Else
   PlayButton.enabled = True
   StopButton.enabled = True
 Endif
End

Public Sub PlayButton_Click()
 Try $hhPlayer.Play
 If Error Then Print Error.text
End

Public Sub StopButton_Click()
 Try $hhPlayer.pause
End

Public Sub PositionTimer_Timer()
 PositionDisplay.text = JDate($hhPlayer.position)
End

Public Function JDate(Durat As Variant) As String
 Dim H As Integer
 Dim M As Integer
 Dim S As Integer
 Dim F As Integer
 Dim HH As String = "00"
 Dim MM As String = "00"
 Dim SS As String = "00"
 Dim FF As String = "00"
 Dim FPS As Integer
 Dim Dur As Integer

   FPS = 25
Dur = Durat * 1000

   H = Dur / (3600 * 1000)
   Dur = Dur Mod (3600 * 1000)
   M = Dur / (60 * 1000)
   Dur = Dur Mod (60 * 1000)
   S = Dur / 1000
   Dur = Dur Mod 1000
   F = (Dur * FPS) / 1000

   HH = Str(H)
   MM = Str$(M)
   SS = Str$(S)
   FF = Str$(F)
If Len(HH) = 1 Then HH = "0" & HH
   If Len(MM) = 1 Then MM = "0" & MM
   If Len(SS) = 1 Then SS = "0" & SS
   If Len(FF) = 1 Then FF = "0" & FF
Return HH & ":" & MM & ":" & SS & ":" & FF

End

Joris ALDERS changed the state of the bug to: Accepted.




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to