Windows Media Player Control

Share your advanced PureBasic knowledge/code with the community.
jak64
Enthusiast
Enthusiast
Posts: 502
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Windows Media Player Control

Post by jak64 »

Hello,
thank you very much Justin, that's exactly what i wanted. That's very kind of you.
Have a nice day and above all, protect yourself well against this damn covid-19 virus ...
jak64
Enthusiast
Enthusiast
Posts: 502
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Windows Media Player Control

Post by jak64 »

Hi,
Thank you.= for your program.
I would like to know the current time of the video that is playing to pause it when the video has played a certain number of seconds.
Can you help me ?
Thank you
Justin
Addict
Addict
Posts: 829
Joined: Sat Apr 26, 2003 2:49 pm

Re: Windows Media Player Control

Post by Justin »

Hi jak64,

i updated wmpTest.pb example, look at the getCurrentTime() procedure, there is a new entry in the menu Playback -> Get current time to activate it.
dige
Addict
Addict
Posts: 1247
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: Windows Media Player Control

Post by dige »

@Justin, thank you very much!! This is the first pb video player, that upscales video smoothly. Great! :D
"Daddy, I'll run faster, then it is not so far..."
User avatar
minimy
Enthusiast
Enthusiast
Posts: 344
Joined: Mon Jul 08, 2013 8:43 pm

Re: Windows Media Player Control

Post by minimy »

Thanks a lot for the code!! work very nice. I was looking the code and trying using a button to go 10 seconds forward or back.
Can you help me please.

This is the procedure code

Code: Select all

Procedure setCurrentTime(pos.d)
   Protected.IWMPControls controls
   controls = wmp_GetControls(g_wmp)
   If controls
      If controls\put_currentPosition(@pos)
         Debug pos
      EndIf
   EndIf
EndProcedure
What im doing bad?

Thank you very much and good job!
If translation=Error: reply="Sorry, Im Spanish": Endif
Justin
Addict
Addict
Posts: 829
Joined: Sat Apr 26, 2003 2:49 pm

Re: Windows Media Player Control

Post by Justin »

Hi minimy,

To go 10 secs forward i use this code, it works here:

Code: Select all

;Advances 10 seconds
Procedure forward()
	Protected.IWMPControls controls
	Protected.d currPos, inCrement

	inCrement = 10
	controls = wmp_GetControls(g_wmp)
	If controls
		controls\get_currentPosition(@currPos)
		controls\put_currentPosition(currPos + inCrement)
	EndIf
EndProcedure
I updated the example with it, to go backward decrease current pos by increment.
User avatar
minimy
Enthusiast
Enthusiast
Posts: 344
Joined: Mon Jul 08, 2013 8:43 pm

Re: Windows Media Player Control

Post by minimy »

hey justin, thanks!! work very good.
If translation=Error: reply="Sorry, Im Spanish": Endif
jak64
Enthusiast
Enthusiast
Posts: 502
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Windows Media Player Control

Post by jak64 »

Hello Justin,
I used your code, it's great.

When I use it, by changing the voice of the narrator in Windows, by putting a male voice, it is always the female voice that is used by the program.

Can you help me ?
Thank you
User avatar
minimy
Enthusiast
Enthusiast
Posts: 344
Joined: Mon Jul 08, 2013 8:43 pm

Re: Windows Media Player Control

Post by minimy »

Hello Justin, im trying to change player volume, but i cant. I was trying with 'controls' but no work.
Can you help me with this or give me a clue :)

Thanks you very much!
If translation=Error: reply="Sorry, Im Spanish": Endif
gregreen
User
User
Posts: 13
Joined: Fri Apr 21, 2023 7:26 pm

Re: Windows Media Player Control - Captions!

Post by gregreen »

I love the help here with WMP playback! Very helpful... But...
I need to display closed captions. I think I figured out how to load the .srt file with put_SAMIfileName(filename$) but how do I show the captions?

In the OpenMovie(m.s) procedure I added
Protected.IWMPClosedCaption core2 = wmp_GetCore(g_wmp)
and after the movie loaded: ( core\put_URL(file) )
I added:
core2\put_SAMIfileName(captionfilename$)

but how to make it show?
Thx to anyone who can point me in the right direction.
Justin
Addict
Addict
Posts: 829
Joined: Sat Apr 26, 2003 2:49 pm

Re: Windows Media Player Control

Post by Justin »

I think that api only works for a control embebed in a HTML page, after using put_captioningId() with the id of the html element that shows the captions it works. There is an example on the windows sdk, this is the result:
Image
You could propbably put the control in a webgadget and should work, but captions are displayed on a separate html element.
Justin
Addict
Addict
Posts: 829
Joined: Sat Apr 26, 2003 2:49 pm

Re: Windows Media Player Control

Post by Justin »

I tried with the webgadget and it actually worked, you can overlay the captions using a fixed positioned div.
Look at the captions.pb example on the first post with the ccsample.smi.
First load the ccsample.smi then load a movie.
This is the result:
Image
gregreen
User
User
Posts: 13
Joined: Fri Apr 21, 2023 7:26 pm

Re: Windows Media Player Control

Post by gregreen »

Thank you Justin, that helps a lot!
Justin
Addict
Addict
Posts: 829
Joined: Sat Apr 26, 2003 2:49 pm

Re: Windows Media Player Control

Post by Justin »

Removed some typos from the example and added font proportional to the video height, looks better specially in fullscreen.

Simply changed "font-size: 4vh" in the .smi file, for fixed size use absolute units like pt, px.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Windows Media Player Control

Post by Kwai chang caine »

Nice code :D
Works good here :wink:
Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
Post Reply