Results 1 to 17 of 17

Thread: Volume and Position Max For Mediaplayer Control

  1. #1

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909

    Question Volume and Position Max For Mediaplayer Control

    How do i set a slider's value to a max that corresponds to the end of a movie file? Also how do i set the volume on a slider?

  2. #2
    Stiletto
    Guest
    Try this for volume:
    [code]
    Private Sub Slider1_Change()
    MediaPlayer1.Volume = Slider1.Value
    End Sub

    Private Sub Slider1_Scroll()
    MediaPlayer1.Volume = Slider1.Value
    End Sub
    [/code[
    Set max of slider to 100 (If u using a vertical slider, set to -100, and use the ABS function - "MediaPlayer1.Volume = ABS(Slider1.Value)")

    Set the min of slider to 0 (If u using a vertical slider, set to 0)

  3. #3

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    What's the ABS function?

  4. #4
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    it stops your car without locking the wheels

    Actually, it's this...
    Returns a value of the same type that is passed to it specifying the absolute value of a number.

    Syntax

    Abs(number)

    The required number argument can be any validnumeric expression. If number contains Null, Null is returned; if it is an uninitialized variable, zero is returned.

    Remarks

    The absolute value of a number is its unsigned magnitude. For example, ABS(-1) and ABS(1) both return 1.

    Example
    VB Code:
    1. Dim MyNumber
    2. MyNumber = Abs(50.3)   ' Returns 50.3.
    3. MyNumber = Abs(-50.3)   ' Returns 50.3.

  5. #5

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    So where should i be putting it? Also does nayone know anything about setting the max for a position slider because if i set to just like 100 it only goes like 2 minutes into the movie?
    Last edited by stickman373; Jul 4th, 2001 at 07:01 PM.

  6. #6
    Stiletto
    Guest
    ABS function returns the absolute value of a number.
    for xample:
    Number=-85
    if u call the ABS function:
    ABS(Number)
    the return value is 85
    BUT if u Number=85 and u call the ABS function, the return value will b 85 again. (and not the oposite, -85)

    U need to put the ABS funstion ONLY if u using a vertical slider, just like i xplained

  7. #7
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by stickman373
    set to just like 100 it only goes like 2 minutes into the movie?
    maybe it's in minutes?

  8. #8

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    So this should be the code:

    Code:
    Private Sub Slider2_Change()
    MediaPlayer1.Volume = Abs(Slider2.Value)
    End Sub
    
    Private Sub Slider2_Scroll()
    MediaPlayer1.Volume = Abs(Slider2.Value)
    End Sub
    Because i use this and when i change the scroll it gives me a mediaplayer error?

    Also Chrisjk i only got a few seconds when i had it at 100 as a max. Anyways there has to be a way to get a exact value it should be set at otherwise there is blank space at the end if i set it to a lareg number like 5000. Every movie is different!
    Last edited by stickman373; Jul 4th, 2001 at 07:09 PM.

  9. #9
    Stiletto
    Guest
    Sory man, but i'm completly sure about the code i gave u...neway, what's the error?

  10. #10
    Stiletto
    Guest
    Sory man, but i'm completly sure about the code i gave u...neway, what's the error?
    ***??? nm, i'll type slower:

    Sorry man, but i'm NOT completly sure about the code i gave u here, what's the error?

  11. #11

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    runtime error -2247352567 (80020009)
    Methosd 'Volume' of object 'IMediaplayer2' failed




    that's the error whe i go to change the slider?

  12. #12
    Stiletto
    Guest
    Do u get this error when u using the Change sub, the Scroll sub, or both??

  13. #13

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    scroll sub gives the error.

  14. #14
    Stiletto
    Guest
    Sorry, i can't figure out what's the prob....

  15. #15

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    Darn!

  16. #16

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    does this slider control i gave you work with that code?

  17. #17
    New Member
    Join Date
    Feb 2001
    Posts
    4

    Talking I have the solution for Windows 95 media player

    HI I had the same problem that stickman373 with the Media Player's error.

    Stiletto said to use the volume's property but I get the next error tring to set positive values, so I tried with the opposite values and found that the maximun volume is getting whit 0 and the minimum volume with the -2300 aprox.

    So the range of values are between 0 (maximun volume) and -2300 (minimun volume).

    But I don't remember if some of this values (negatives) cause error cause I used the instruction On Error Resume Next to provide break the application with positive values.

    So here's the code

    private sub Command1_Click()

    On error Resume Next
    MediaPlayer1.Volume=Text1.text

    End Sub

    I'm working with a value located in a TextBox


    So you performance this code without the Instruction On error Resume next, but remember the range of values

    I don't know if Stiletto have Windows 98 or any different version of Media Player provided in Windows 95 (sorry I can't check the version cause I isn't in my computer) but I hope the code work good at all version even in Media Player 7

    Ok that's all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width