Using the media component

Post Reply
bill-lancaster
Posts: 44
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Using the media component

Post by bill-lancaster » Saturday 22nd December 2018 12:38pm

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

vuott
Posts: 20
Joined: Wednesday 05th April 2017 6:07pm

Re: Using the media component

Post by vuott » Saturday 22nd December 2018 7:45pm

Hello,

about audio file path you have to use:

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

bill-lancaster
Posts: 44
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Re: Using the media component

Post by bill-lancaster » Sunday 23rd December 2018 5:43pm

Thanks vuott

vuott
Posts: 20
Joined: Wednesday 05th April 2017 6:07pm

Re: Using the media component

Post by vuott » Wednesday 26th December 2018 3:43pm

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

Post Reply