« Full Time Xojo Develo… | Home | FileMaker DevCon in 1… »

Tip of the day: MoviePlayer.rate

Today a client asked how to set MoviePlayer's rate. This property was there years ago in Real Studio, but is missing in current Xojo version. The following code in a module extends MoviePlayer class with a new rate property. We even included some switches for older Real Studio versions, so you can use similar code for older and newer IDE versions:

Sub RateMBS(extends m as MoviePlayer, assigns r as Double) #if TargetMacOS then #if RBVersion >= 2014.0 then // newer AVFoundation dim p as AVPlayerMBS = m.AVPlayerMBS p.rate = r #else // old QuickTime m.Rate = r #endif #elseif TargetWin32 then #if RBVersion < 2014.0 then // older m.Rate = r Return #endif // Windows Media Player dim o as OLEObject = m.MovieController MsgBox o.TypeName o.Player.settings.rate = r #endif End Sub
09 05 15 - 13:08