Help - Search - Members - Calendar
Full Version: VB Streaming video player
ieXbeta Board > Tech > Developer Center
TristanAnderson
Hi guys. For a personal project I'm trying to make a visual basic program which will play a video which is stored on a server. Does anybody know of any tutorial sites that may point me in the right direction for this?
Many thanks in advance smile.gif
- T
Chugworth
Well if you insert a Windows Media Player control, then it's as simple as saying:

CODE
MediaPlayer.URL = "http://server/file.wmv"

(where "MediaPlayer" is the control name)

In VB6, just right-click in your toolbox, choose "Components" then check "Windows Media Player."

In VB.NET 2005, right-click in your toolbox, click "Choose Items," "COM Components," then check "Windows Media Player."
TristanAnderson
Thanks Chugworth smile.gif What I'm hoping to eventualy have is a media player where a user can sellect which video they wish to view from a dropdown menu.
I'm a total novice with things like this, so i'll probably end up paying someone to make it, but didnt think it could hurt to give it a bash myself smile.gif
Chugworth
QUOTE(TristanAnderson @ Mar 12 2007, 20:28) *

Thanks Chugworth smile.gif What I'm hoping to eventualy have is a media player where a user can sellect which video they wish to view from a dropdown menu.
I'm a total novice with things like this, so i'll probably end up paying someone to make it, but didnt think it could hurt to give it a bash myself smile.gif

Ok. It's really easy though. I just opened VB.NET 2005 and put together a program that does that. Here is what it looks like:

IPB Image

And here is the code behind it:

CODE
Public Class Form1

    Private Sub cmdFill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFill.Click
        ComboBox1.Items.Add("mms://a540.m.akastream.net/7/540/5372/1/gamespot.download.akamai.com/5372/netshow/gslive/2006/03/169_crysis_pc_gp_0323063_700.wmv")
        ComboBox1.Items.Add("mms://a1758.m.akastream.net/7/1758/5372/1/gamespot.download.akamai.com/5372/netshow/gslive/2006/03/tombradierleg_ot_mul_031006_700.wmv")
        ComboBox1.Items.Add("mms://a1456.m.akastream.net/7/1456/5372/1/gamespot.download.akamai.com/5372/netshow/gslive/2005/03/legendofzelda_031005ot2_700.wmv")
        ComboBox1.Text = "Select an item"
    End Sub

    Private Sub cmdClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClear.Click
        ComboBox1.Items.Clear()
    End Sub

    Private Sub cmdPlayThis_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPlayThis.Click
        AxWindowsMediaPlayer1.URL = ComboBox1.Text
    End Sub

    Private Sub cmdPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPlay.Click
        AxWindowsMediaPlayer1.Ctlcontrols.play()
    End Sub

    Private Sub cmdStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStop.Click
        AxWindowsMediaPlayer1.Ctlcontrols.stop()
    End Sub
End Class


The button called "Fill ComboBox with items" (cmdFill) adds three links to the ComboBox. You could then select a link, and click "Play This" (cmdPlayThis). The other command buttons just give examples of controlling the player, and clearing the ComboBox.

But remember that's done in VB.NET 2005. Code for VB6 would look slightly different. Since you're just beginning, I would recommend starting out with VB.NET 2005. There's no sense in learning the old version now.
TristanAnderson
You are more help than google could ever be biggrin.gif

There is one problem though. I'm embarrased asking because I know that its going to be soemthing SOOOOOOO simple I'll get laughed at, but like I said, I am new to this :$

When I publish the program from visual studio, it appears as a .application file, not .exe

It also pops up with a whole load of security questions, and on other computers, says that there are components missing.

In short, why, and how do I fix this :$
Chugworth
QUOTE(TristanAnderson @ Mar 12 2007, 21:09) *

You are more help than google could ever be biggrin.gif

There is one problem though. I'm embarrased asking because I know that its going to be soemthing SOOOOOOO simple I'll get laughed at, but like I said, I am new to this :$

When I publish the program from visual studio, it appears as a .application file, not .exe

It also pops up with a whole load of security questions, and on other computers, says that there are components missing.

In short, why, and how do I fix this :$

I usually just go to Build>Build (ProgramName). You will find the EXE file in the "bin\Release" folder of wherever you saved your project to. The computers that you run this on will need the .NET Framework 2.0 installed. It's already included in Vista.
TristanAnderson
Thanks smile.gif
TristanAnderson
Now this is where i probably WILL get out of my depth, but like i said, cant hurt to try.

How easy would it be to have a username and password box (and a login button) which checks the provided details against an ms access database on the server? allowing only certain people to use the player? is this even worth a novice trying or too indepth?

idealy i'd like to have a username, a password, and an expiray date for that account, ie, if a user logs in after the date specified for their account in the database, videos will not play?


i get the feeling that this could be complicated tongue.gif
DangerousDave86
What I think you need to do is combine it with some server side scripting.
Have a user name and Password dialog box, or something store an entered user name in a global variable (or object - whatevers available in the .Net app). Then, send requests to a server side script over HTTP using that usern ame and password as page variables ?user=&pass= which then sends a HTTP redirect to the MMS source (or doesn't) - it could also handle expiry dates easily.
I don't think you can possibly use the .Net app to check access against a server side database without causing serious security problems.

Is this a commercial project?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.