Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ouch, FoxPro let me down - duration = 0.00000
Message
From
01/01/2018 18:30:25
 
 
To
31/12/2017 19:44:50
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01656859
Message ID:
01656876
Views:
83
on your question "But when you just let it rip the Duration is 0.00000."
Windows media player must load the media to determine its duration and others properties.As IE it must pass the transitionnings (playstate event)
On Key Label F2 wmp=Null  &&press F2 to  quit wmp

Local  wmp As WindowsMediaPlayer
wmp = Createobject("WMPlayer.OCX.7")
With wmp
  .url=Getfile("mp3|wav")
  .settings.autoStart = .T.
  .settings.Volume=80
  .settings.setMode('loop',.F.)    &&.t. for loop
  .Controls.Play()

  Local m.xdur
  Do While !.currentmedia.duration >0  &&the wmp must pass the transitionnings to work as expected(as IE)
    Inkey(0.1)
  Enddo
  m.xdur=.currentmedia.duration
  _Cliptext=Trans(m.xdur,"999999.99")+"  or  "+.currentmedia.DurationString
  Messagebox("Duration="+Trans(m.xdur,"999999.99")+" sec DurationString="+.currentmedia.DurationString,0+32+4096,'in the clipboard',3000)

Endwith
Inke(m.xdur+0.5)  &&wait until the media is done.can press F2 to exit.note WMP is invisible here.
wmp=Null
Release wmp
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform