MoviePlayer Control available in REALbasic displays a control for playing Quicktime and Windows Media Player movies. It can be also used as a MP3 player or PDF viewer. Let’s look into some REALbasic MoviePlayer Control examples.
Windows uses the Windows Movie Player to play movies and Mac OS uses the QuickTime player. On Linux, the MoviePlayer uses GStreamer by default (it requires version 0,10+) and uses Xine if GStreamer is not available.
The Controller property dictates how the movie controls (if any) will be displayed. Passing 0 (zero) means that there will be no user controls available. Passing 1 means that a movie icon or badge will be displayed in the lower left corner of the movie area instead of the controller. When this badge is clicked by the user, the badge disappears and the regular movie controls appear at the bottom of the movie frame. Passing 2 displays the regular movie controls.
Here you can find how to check if QuickTime is installed in system.
1 2 3 | if System.QuickTime.Installed then MsgBox "QuickTime detected!" end if |
This example loads a movie called REALbasicMovie.mp4 from the current directory into MoviePlayer1 and plays it.
1 2 3 4 5 6 | Dim f As FolderItem f = GetFolderItem("REALbasicMovie.avi") MoviePlayer1.Movie = f.OpenAsMovie MoviePlayer1.Play |
Display the current video or audio position from MoviePlayer Control.
1 2 3 | Dim p As Double //Double is a number that can contain a decimal value, i.e., a real number. p = MoviePlayer1.MovieController.Controls.CurrentPosition |
So wait, the MoviePlayer control doesn’t work with Linux?
If you like to use MoviePlayer Control on Linux you must install GStreamer or Xine multimedia framework. Without them the MoviePlayer Control doesn’t work.
So how would you setup the GetFolderItem to pickup a file on a samba share.
How would you ask the player to play a live mp3 stream or video??
Thanks\John
Hello,
solution for you John B
Dim s As Sound
Dim f As FolderItem
f = New FolderItem(“realbasic.mp3″)
s = f.OpenAsSound
s.Play
Dim MP3 As New FileType
MP3.Name = “MP3 files”
MP3.Extensions = “.mp3″
Dim File1 As FolderItem = GetOpenFolderItem(MP3Types)
if File1 nil then
MoviePlayer1.Movie = File1.OpenAsMovie
end if
MoviePlayer1.Play