Results 1 to 11 of 11

Thread: Windows Media Control

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2011
    Posts
    5

    Windows Media Control

    Hello,

    I'm kinda new to this. Done it a bit a while back, completed a simple conversation program, and started a text game..but decided to take it back up and make a new interaction fiction game with videos..

    the thing I'm having a problem with right now is the windows media player control. I make my first intro movie play by placing it's location in the URL property...I'm wondering how you would code it to play the second intro video I have once that one comes to an end..

    I may just put the two videos together to make this easier...but in the future I may need to know this information so any help would be greatly appreciated.

    thanks,
    JB.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Windows Media Control

    I don't know the answer to your question but, at a guess, I would say that the WMP control would raise an event when the current media file finishes. If so, you should be able to handle that event and then do for the second file just what you did for the first. I'd suggest that you check out that possibility first.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Windows Media Control

    try this:

    vb Code:
    1. Public Class Form1
    2.  
    3.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    4.  
    5.         Dim movie1 = AxWindowsMediaPlayer1.newMedia("first_intro_movie.mpg")
    6.         Dim movie2 = AxWindowsMediaPlayer1.newMedia("second_intro_movie.mpg")
    7.         AxWindowsMediaPlayer1.currentPlaylist.appendItem(movie1)
    8.         AxWindowsMediaPlayer1.currentPlaylist.appendItem(movie2)
    9.  
    10.     End Sub
    11.  
    12.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    13.         AxWindowsMediaPlayer1.Ctlcontrols.play()
    14.     End Sub
    15.  
    16. End Class

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Windows Media Control

    Nice one Paul. A playlist makes much more sense.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2011
    Posts
    5

    Re: Windows Media Control

    Hey, thanks.

    I'm gonna see if I can play around with it and figure it out...I'm quite new to this, so I may need some help...I forget most of what I learned last year, lol. I'm sorta like a Jack of all trades, but master of none, lol..everything from rap, to this.

    http://www.myspace.com/mystikmusikentertainment

    buuut anyway..

    this line of code here..

    Code:
    AxWindowsMediaPlayer1.currentPlaylist.appendItem(movie1)
    (movie1) is that replaced with the file path?

  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Windows Media Control

    Dim movie1 = AxWindowsMediaPlayer1.newMedia("filepath")
    Dim movie2 = AxWindowsMediaPlayer1.newMedia("filepath")
    AxWindowsMediaPlayer1.currentPlaylist.appendItem(movie1)
    AxWindowsMediaPlayer1.currentPlaylist.appendItem(movie2)

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2011
    Posts
    5

    Re: Windows Media Control

    oh I see movie1 and movie2 are variables...I sorta overlooked the code to quickly, lol..thanks for the help man! I'll report back if I have troubles, lol.

  8. #8

    Thread Starter
    New Member
    Join Date
    Feb 2011
    Posts
    5

    Re: Windows Media Control

    actually would you call that a variable, or something else?

  9. #9
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Windows Media Control

    they are variables. they are declared inside a procedure so their scope is limited to use within that procedure. you can also use variables at class or project level if they are declared in the appropriate places.

  10. #10

    Thread Starter
    New Member
    Join Date
    Feb 2011
    Posts
    5

    Re: Windows Media Control

    yup, I remember that. I just didn't know where they weren't declaired as integers, floats, or something to that effect what it would be classified as...lol...does it get automatically declaired as something else? lol

  11. #11
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Windows Media Control

    in vb2008+ you don't need to use As clauses because of Option Infer.
    if you want to declare them with As clauses, hover your mouse over the newMedia keyword to get the type

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