It is currently Mon Feb 17, 2020 4:58 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: PlayMovie
PostPosted: Thu Jul 18, 2019 10:50 pm 
Offline
New User
New User

Joined: Tue Dec 27, 2016 11:13 pm
Posts: 5
[5.71 Beta2 LTS (x32)] - Windows 10

Playmove does not work i only get a white window

PureBasic Version 5.51 (x32) is working, all versions higher than 5.51 will not work anymore

Code:
InitMovie()

OpenWindow(0, 0, 0, 400, 300, "A screen in a window...", #PB_Window_SizeGadget | #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 170, 135, 45, 20, "Quit")
PanelGadget(1,5,5,390,290)
AddGadgetItem(1,-1,"2")
AddGadgetItem(1,0,"1")
CloseGadgetList()

LoadMovie(0,"test.wmv")
SetGadgetState(1,0)

Repeat
 Event = WaitWindowEvent()
    If Event=#PB_Event_Gadget
        Num =GetGadgetState(1)
        Result$ = GetGadgetItemText(1, Num,0)
        If Result$ = "2"
            If Movieflag = 0
                PlayMovie(0,GetTopWindow_(GadgetID(1)))
                ResizeMovie(0,0,(265-(MovieHeight(0)*384/MovieWidth(0)))/2,384,MovieHeight(0)*384/MovieWidth(0))
            Else
                ResumeMovie(0)
            EndIf
        ElseIf Result$ = "1"
            If IsMovie(0)
               PauseMovie(0)
               Movieflag = 1
            EndIf
        EndIf
    EndIf
Until Event = #PB_Event_CloseWindow


Top
 Profile  
Reply with quote  
 Post subject: Re: PlayMovie
PostPosted: Mon Aug 26, 2019 8:56 am 
Offline
User
User

Joined: Fri Aug 04, 2017 11:03 pm
Posts: 79
Sorry for the earlier post. :oops:

Hope this isof any help.
Code:
InitMovie()
flg= #PB_Window_SizeGadget | #PB_Window_SystemMenu | #PB_Window_ScreenCentered
OpenWindow(0, 0, 0, 400, 300, "A screen in a window...",flg)
ButtonGadget(0, 170, 135, 45, 20, "Quit")
PanelGadget(1,5,5,390,290)
AddGadgetItem(1,-1,"2")
AddGadgetItem(1,0,"1")

ButtonGadget(16, 3, 14, 100, 20, "Open")
ButtonGadget(17, 3, 34, 100, 20, "Play")
ButtonGadget(18, 3, 56, 100, 20, "Pause")
CloseGadgetList()

LoadMovie(0,"carribean.wmv")
SetGadgetState(1,0)

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      AppQuit = 1
     
    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()

    Case 16 ; "Open")
      MovieName$ = OpenFileRequester("Choose the movie to play", "", "Movie files|*.wmv|*.mp4|All Files|*.*", 0)
      LoadMovie(0, MovieName$)
   
     Case 17   ;Play
      SetGadgetState(1,1)
      If SetGadgetState(17,1)
           
      PlayMovie(0,GetTopWindow_(GadgetID(1)))
      ResizeMovie(0,0,(265-(MovieHeight(0)*384/MovieWidth(0)))/2,384,MovieHeight(0)*384/MovieWidth(0))
      Else
      ResumeMovie(0)
      EndIf
             
     Case 18 ;Pause
          If SetGadgetState(18,1)
           PauseMovie(0)
          Else
          ResumeMovie(0)
          EndIf
     EndSelect

  EndSelect
Until AppQuit


Top
 Profile  
Reply with quote  
 Post subject: Re: PlayMovie
PostPosted: Sun Sep 22, 2019 4:57 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13891
Location: France
Since 5.60, the PanelGadget() can have 2 EventType(): change and resize. Resize is always fired when a new panel is first displayed to allow layout. So you will need to take that in account in your code.

Code:
InitMovie()

OpenWindow(0, 0, 0, 400, 300, "A screen in a window...", #PB_Window_SizeGadget | #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 170, 135, 45, 20, "Quit")
PanelGadget(1,5,5,390,290)
AddGadgetItem(1,-1,"2")
AddGadgetItem(1,0,"1")
CloseGadgetList()

LoadMovie(0,"720.wmv")
SetGadgetState(1,0)

Repeat
  Event = WaitWindowEvent()
  If Event=#PB_Event_Gadget
   
    If EventGadget() = 1 And EventType() = #PB_EventType_Change ; Important to filter on the correct event type
      Num = GetGadgetState(1)
      Result$ = GetGadgetItemText(1, Num,0)
      If Result$ = "2"
        If Movieflag = 0
          PlayMovie(0,GetTopWindow_(GadgetID(1)))
          ResizeMovie(0,0,(265-(MovieHeight(0)*384/MovieWidth(0)))/2,384,MovieHeight(0)*384/MovieWidth(0))
        Else
          ResumeMovie(0)
        EndIf
      ElseIf Result$ = "1"
        If IsMovie(0)
          PauseMovie(0)
          Movieflag = 1
        EndIf
      EndIf
    EndIf
  EndIf
Until Event = #PB_Event_CloseWindow


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 14 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