It is currently Wed Sep 30, 2020 10:30 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Primitive Video Player
PostPosted: Wed Jun 10, 2020 8:42 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Oct 24, 2005 1:05 pm
Posts: 739
I need to be able to play videos and keep track of the location of the play head in frames, so I came up with this. Eventually a frame counter will be added.

Suggestions for improvements invited. I may not have the frame rate exactly right but it's close.

Code:
If InitMovie() = 0
  MessageRequester("Error", "Can't initialize movie playback!", 0)
  End
EndIf

;MovieName$ = OpenFileRequester("Choose the movie to play", "", "Movie files|*.avi;*.mpg;*.mp4;*.mkv|All Files|*.*", 0)
movieName$ = "D:\Videos\Interpositives\Short.avi"

Global frameCount = 0

If MovieName$
  If LoadMovie(1, MovieName$)
 
;Global framedur.d = (1/29.97) * 1000
If MovieInfo(1,0) = 29: fps = 29.97: ElseIf MovieInfo(1,0) = 59: fps = 59.94:EndIf
Global framedur.d = 1/fps * 1000

OpenWindow(1, 100, 150, MovieWidth(1), MovieHeight(1), "PureBasic - Movie")
    PlayMovie(1, WindowID(1))
   
For ct = 1 To 1000
PauseMovie(1) : Delay(frameDur)
frameCount + 1:MovieSeek(1,frameCount)
ResumeMovie(1)
Next

PauseMovie(1)

    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  Else
    MessageRequester("Error", "Can't load the movie...", 0)
  EndIf
EndIf


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye