Page 1 of 1

Using the media component

Posted: Saturday 22nd December 2018 12:38pm
by bill-lancaster
If I run this code:-

Code: Select all

Private gPlayer As New MediaPlayer

Public Sub Form_Open()

gPlayer.URL = User.Home &/ "a.mp3"

End

Public Sub Button1_Click()
Print gPlayer.State;; gPlayer.Length
gPlayer.Play()

End
I get 'cannot set status', what is missing?
v 3.11.4

Re: Using the media component

Posted: Saturday 22nd December 2018 7:45pm
by vuott
Hello,

about audio file path you have to use:

gPlayer.URL = Media.URL(User.Home &/ "a.mp3")

Re: Using the media component

Posted: Sunday 23rd December 2018 5:43pm
by bill-lancaster
Thanks vuott

Re: Using the media component

Posted: Wednesday 26th December 2018 3:43pm
by vuott
Just a little example:
Private gPlayer As New MediaPlayer

Public Sub Main()
  
  gPlayer.URL = Media.URL(User.Home &/ "a.mp3")

  gPlayer.Play()

  Print Date(0, 0, 0, 0, 0, 0, gPlayer.Length * 1000)

  Repeat
    Write "\r" & CStr(Date(0, 0, 0, 0, 0, 0, gPlayer.Position * 1000))
    Wait 0.001
  Until gPlayer.Position >= gPlayer.Length

  gPlayer.Close

End