Platforms to show: All Mac Windows Linux Cross-Platform

/Audio/WindowsMCI/DropMoviePlayer
Function:
Required plugins for this example: MBS Audio Plugin, MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Audio/WindowsMCI/DropMoviePlayer
This example is the version from Sun, 17th Mar 2012.
Project "DropMoviePlayer.xojo_binary_project"
FileTypes
Filetype video/avi
Filetype video/flc
Filetype video/mpeg
Filetype video/msvideo
Filetype video/quicktime
Filetype video/x-dv
Filetype video/x-mpeg
Filetype video/x-msvideo
End FileTypes
MenuBar Menu
MenuItem UntitledMenu9 = ""
MenuItem UntitledMenu8 = "File"
MenuItem FileOpen = "Open..."
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu6 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu7 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu4 = "Movie"
MenuItem MoviePlay = "Play"
MenuItem MovieStop = "Stop"
MenuItem MoviePause = "Pause"
MenuItem MovieResume = "Resume"
MenuItem UntitledMenu5 = "-"
MenuItem MovieSpeed50 = "Speed 50%"
MenuItem MovieSpeed100 = "Speed 100%"
MenuItem MovieSpeed200 = "Speed 200%"
MenuItem UntitledMenu3 = "Window"
MenuItem WindowHide = "Hide"
MenuItem WindowShow = "Show"
MenuItem UntitledMenu1 = "Sound"
MenuItem SoundLeftoff = "Left off"
MenuItem SoundLefton = "Left on"
MenuItem SoundRighton = "Right on"
MenuItem SoundRightoff = "Right off"
MenuItem Soundon = "on"
MenuItem Soundoff = "off"
MenuItem UntitledMenu2 = "-"
MenuItem SoundVolume100 = "Volume 100%"
MenuItem SoundVolume50 = "Volume 50%"
MenuItem UntitledMenu0 = "Video"
MenuItem Videoon = "on"
MenuItem Videooff = "off"
End MenuBar
Class App Inherits Application
EventHandler Sub NewDocument() msgBox "Please drop files on this application!" quit End EventHandler
EventHandler Sub OpenDocument(item As FolderItem) openmovie item End EventHandler
Sub openmovie(f as folderItem) dim m as movie // first try via QuickTime m=f.openasmovie if m<>nil then // got it quickTimeWindow.play m return // exit end if if targetWin32 then windowsMCIPlayer.play f else msgBox "Die Datei ist kein Film für QuickTime!" // <-- CONVERTED end if End Sub
Property v As windowsMCIMBS
End Class
Class QuickTimeWindow Inherits Window
Control Player Inherits MoviePlayer
ControlInstance Player Inherits MoviePlayer
EventHandler Sub Stop() if ready then quit end if End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
EventHandler Function KeyDown(Key As String) As Boolean if asc(key)=27 then quit return true end if End EventHandler
EventHandler Sub Open() left=0 top=0 width=screen(0).width height=screen(0).height End EventHandler
Sub play(m as movie) player.width=m.BaseMovieWidth player.height=m.BaseMovieheight player.left=(width-player.width)/2 player.top=(height-player.height)/2 player.movie=m player.play show ready=true End Sub
Property ready As boolean
End Class
Class WindowsMCIPlayer Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() v.command="status mymovie mode" v.run if v.result="stopped" then quit end if End EventHandler
End Control
EventHandler Function KeyDown(Key As String) As Boolean if asc(key)=27 then quit return true end if End EventHandler
EventHandler Sub Open() left=0 top=0 width=screen(0).width height=screen(0).height End EventHandler
Sub play(f as folderItem) dim s as string dim typ as string dim w,h,l,t as integer v=new WindowsMCIMBS s=f.ShortPathMBS if right(s,4)=".avi" then typ="avivideo" else typ="mpegvideo" end if v.command="open "+s+" type "+typ+" alias mymovie style child parent "+format(winHWND,"0") v.run if v.errorcode<>0 then msgBox v.errorstring quit return end if v.command="where mymovie window" v.run s=v.result // the position of the movie like "0 0 360 315" w=val(nthField(s," ",3)) // extract width h=val(nthField(s," ",4)) // extract height l=(width-w)/2 // calculate left t=(height-h)/2 // calculate top v.command="put mymovie window at "+format(l,"0")+" "+format(t,"0")+" "+format(w,"0")+" "+format(h,"0") v.run v.command="play mymovie" v.run End Sub
Property v As windowsmciMBS
End Class
End Project

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Audio Plugin.

The biggest plugin in space...




Links
MBS Xojo Plugins

Start Chat