I want to stream movies from remote server to the client, can anyone help me with the
Hi all, i want to stream movies from the remote server to the client pc using visual basic 6.0, can anyone help me with the coding please, it would be great, thanks.
Re: I want to stream movies from remote server to the client, can anyone help me with
Actually i would like to store the movies in the remote server which is not from any site, so that the client can stream multiple movies by just clicking on the movie, can i do this using winsock and windows media player, i am storing movies in .wmv extension, thanks
Re: I want to stream movies from remote server to the client, can anyone help me with
I am using winsock control to connect client and server, but i dont know how to put the movies into buffer and then retrieve movies for the client to watch, pls explain how this buffering works, can anyone help with the coding.
Re: I want to stream movies from remote server to the client, can anyone help me with
TsterT's code seems like it would work. All you need is the path of the video. Just insert the path into the URL and the Windows Media Player should take care of the buffering and playing.
Do you have the path of the remote videos? If not, you could use the CommonDialog control to find them (the Open Dialog).
VBNetDude - Thinking Programmatically By Silver Seal Software
Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most!
Re: I want to stream movies from remote server to the client, can anyone help me with
How would i get movie streamed from the server without downloading it to client and then playing, Can you explain what is common dialog control and what it does, if possible can u give an example coding, thank you so much for all your replies.
Re: I want to stream movies from remote server to the client, can anyone help me with
This demonstrates how to use a CommonDialog Control:
If you don't have the CommonDialog in your toolbox refer to the pictures I have included.
You will need to have a textbox and a command button on the form.
The following code should go in the command button's Click Event:
Code:
'Set Text in the title
Me.CommonDialog1.DialogTitle = "Browse For Video File"
'Set the filter. This way the user cannot select a text file or something...
Me.CommonDialog1.Filter = "Windows Media Video (*.wmv)|*.wmv"
'Show the Open Dialog
Me.CommonDialog1.Action = 1
'If the user clicked the cancel button then the FileName will be Null. If the
user click OK then we will put the text in the text box
If Me.CommonDialog1.FileName <> "" Then
MsgBox "The file's path was found successfully."
Me.Text1.Text = Me.CommonDialog1.FileName
End If
All you need to do is browse to the file in click 'Open'. You can then put the path in the URL in the Windows Media Player. It should stream without downloading.
Last edited by VBNetDude; Nov 30th, 2009 at 04:49 PM.
VBNetDude - Thinking Programmatically By Silver Seal Software
Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most!
Re: I want to stream movies from remote server to the client, can anyone help me with
I have a program for file transfer from remote server to client and it works perfect, but i want to modify the code so that client can stream multiple videos from remote server instead of downloading it first, can any one help me with this modification, very urgent pls help me, i will post the client and server program here
Client :
Code:
Option Explicit
'
' '
' Sample client to the file transfer server (fServer.frm). This shows how to
' handle the very simple protocol between the client/server, and how to save
' the pieces of data as one consecutive file, in binary mode.
'
'
' ' Private variables.
'
Private m_blnTransferring As Boolean
Private m_strFilename As String
'
' Control events.
'
'
Private Sub cmdConnect_Click()
'
' Connect to the localhost on port 10101.
Call lstEvents.AddItem("Connecting to 127.0.0.1")
With Winsock
Call .Close
.RemoteHost = "127.0.0.1"
.RemotePort = 10101
Call .Connect
End With
'
End Sub
'
Private Sub cmdClose_Click()
'
Call Unload(Me)
'
End Sub
'
' Winsock events.
'
Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
'
Dim strData As String
Dim hFile As Long
'
' Grab the incoming data.
Call Winsock.GetData(strData)
'
' If we're not in a file transfer operation, this could well be a "BOF".
If (Not m_blnTransferring) Then
'
If (Mid$(strData, 1, 3) = "BOF") Then
'
' We have an incoming file - save the filename, and set the operation
' flag so that next time data arrives (file data) it will be saved.
Call lstEvents.AddItem("Received BOF - incoming file:" & Mid$(strData, 4))
m_blnTransferring = True
m_strFilename = Mid$(strData, 4)
'
' Send back a "NEXT" to get some of the file data.
Call lstEvents.AddItem("Requesting first piece")
Call Winsock.SendData("NEXT")
DoEvents
'
End If
'
Else
'
' If we're already in a transfer, this data could either be file data, or
' an EOF marker.
If (Mid$(strData, 1, 3) = "EOF") Then
'
' The transfer is complete.
m_blnTransferring = False
Call lstEvents.AddItem("Received EOF, transfer complete")
DoEvents
'
Else
'
' Open a temporary file in the current directory - this is where all the
' file data is saved.
hFile = FreeFile
Open App.Path & "\temp.bmp" For Binary As #hFile
'
' Move to the end of the file, and write the data.
Seek #hFile, LOF(hFile) + 1
Put #hFile, , strData
'
Close #hFile
'
' Send the server another "NEXT" command to get the next piece of data.
Call lstEvents.AddItem("Data arrived, requesting next piece")
Call Winsock.SendData("NEXT")
DoEvents
'
End If
'
End If
'
End Sub
'
Private Sub Winsock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
'
' An error has occurred. Log the event and shutdown the connection.
Call lstEvents.AddItem(Description)
Call lstEvents.AddItem("Shutting down")
'
Call Winsock.Close
m_blnTransferring = False
'
End Sub
'
' EOF.
'
Server:
Code:
Option Explicit
'
'
' A very simple and primitive file sender, this project will demonstrate
' binary file techniques, handling the binary data, and sending a file in
' chunks of xKB at a time.
'
' Three commands are used during the transfer process:
'
' BOF (Beginning Of File) - This is used to indicate to the remote host that a
' file is on it's way.
'
' NEXT (Next chunk please) - A host receiving a file will send this each time
' it wants the next piece of the file.
'
' EOF (End Of File) - This is send to the remote host once all the file data
' has been transmitted. The remote host can then let the user know the transfer
' is complete.
'
' The general sequence is this:
' 1. Both hosts connect. The server is going to send the client a file.
' 2. Server: Send "BOF[filename]"
' 3. Client: Send "NEXT"
' 4. Server: If there's more data, send it.
' If there's no more data, send "EOF".
' 5. Client: If data has arrived, send "NEXT".
' If "EOF" has arrived, transfer is complete.
'
' '
' Constants.
' '
Private Const CHUNK_SIZE As Long = 3072 ' 3KB.
'
' Private variables.
' '
Private blnTransferring As Boolean
Private lngFilePos As Long
Private strFilename As String
'
' Form events.
'
Private Sub Form_Load()
'
' Show the client form, and start listening.
Call StartServer
'
End Sub
'
' Control events.
'
'
Private Sub cmdClose_Click()
'
Call Unload(Me)
'
End Sub
'
Private Sub cmdSendFile_Click()
'
' Start the file sending procedure.
Call lstEvents.AddItem("Initializing transfer")
Call SendFile(App.Path & "\..\logo.bmp")
'
End Sub
'' Private helpers.
'
Private Sub StartServer()
'
' Set the Winsock up to listen on port 10101.
Call lstEvents.AddItem("Server started, listening on 10101")
With Winsock
Call .Close
.LocalPort = 10101
Call .Listen
End With
'
End Sub
'
Private Sub SendFile(ByVal strFile As String)
'
' Store the filename for later.
strFilename = strFile
'
Call lstEvents.AddItem("Sending BOF: " & strFilename)
'
' Set the transferring flag (since we're now connected), and send the BOF
' marker - this instructs the remote host that a file is on it's way.
blnTransferring = True
Call Winsock.SendData("BOF" & strFilename)
DoEvents
'
End Sub
'
Private Sub SendNextChunk()
'
Dim hFile As Long
Dim lngChunkSize As Long
Dim strData As String
'
' If we're not currently connected and transferring, exit. This shouldn't
' happen, but just in case...
If (Not blnTransferring) Then Exit Sub
'
' Open the file that we're sending, for BINARY mode. This means that we can
' read out bits regardless of what's in the file (text, image, music etc..).
hFile = FreeFile
Open strFilename For Binary As #hFile
'
' We need to read the next unsent piece of the file, so move through the
' file past all the bits we've already sent. Then, when we read into
' strData, the data will be the next consecutive bytes.
If (lngFilePos = 0) Then lngFilePos = 1
Seek hFile, lngFilePos
'
' Work out how large this chunk is going to be. Normally, it will be the
' standard CHUNK_SIZE, but if the last piece is less than that, decrease it.
lngChunkSize = LOF(hFile) + 1 - lngFilePos
If (lngChunkSize > CHUNK_SIZE) Then lngChunkSize = CHUNK_SIZE
'
' If the chunksize was 0, it means there's no data left to send, so our
' transfer is complete.
If (lngChunkSize = 0) Then
'
' Send the EOF marker so the remote host knows that's all the data.
strData = "EOF"
blnTransferring = False
Call lstEvents.AddItem("0 bytes, transfer completed. Sending EOF.")
'
' Send the data to the remote host.
Call Winsock.SendData(strData)
DoEvents
'
Else
'
' Grab the data from the file, and increment our file pointer so that next
' time we read, we are reading the next piece of the file.
strData = String$(lngChunkSize, 0)
Get #hFile, , strData
lngFilePos = lngFilePos + lngChunkSize
'
' Send the data to the remote host.
Call Winsock.SendData(strData)
Call lstEvents.AddItem("Sent " & lngChunkSize & " bytes")
DoEvents
'
End If
'
Close #hFile
'
End Sub
' Winsock events.
' '
Private Sub Winsock_ConnectionRequest(ByVal requestID As Long)
'
' Accept the incoming connection from the client.
With Winsock
Call .Close
Call .Accept(requestID)
End With
Call lstEvents.AddItem("Incoming connection request, accepted")
'
cmdSendFile.Enabled = True
'
End Sub
'
Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
'
Dim strData As String
'
' Grab the incoming data and check it.
Call Winsock.GetData(strData)
If (strData = "NEXT") Then
'
' The remote host has asked for the NEXT chunk.. so send it to them!
Call lstEvents.AddItem("Sending next chunk.")
Call SendNextChunk
'
Else
'
' Data has arrived and we're not sure what it is. This shouldn't happen,
' but for debugging purposes, display it.
Call MsgBox(strData)
'
End If
'
End Sub
'
Private Sub Winsock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
'
' An error has occurred somewhere. Log the event, and shutdown the connection.
Call lstEvents.AddItem(Description)
Call lstEvents.AddItem("Shutting down")
'
Call Winsock.Close
blnTransferring = False
'
End Sub
'
'
' EOF.
'
Last edited by si_the_geek; Dec 1st, 2009 at 08:27 AM.
Reason: corrected code tags
Re: I want to stream movies from remote server to the client, can anyone help me with
Originally Posted by yuvarajv
how do i play video file located on another computer or how will i use common dialog control to open files from another pc
First of all, is the remote computer part of your network? If this is the case, you can use the CommonDialog to open the file. It can be found under (in XP) My Network Places->Entire Network->Microsoft Windows Network->"Remote Computer's Workplace"->"Remote Computer's Name". Of course, you will have to share the directory on the remote computer. I am not a network guy, so you will have to consult one if you have trouble.
Another scenario could be that the movies are stored on the ftp. Then you would have to get the address of that and browse it. That may be a little tougher. I would have to look that one up.
VBNetDude - Thinking Programmatically By Silver Seal Software
Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most!
Re: I want to stream movies from remote server to the client, can anyone help me with
yuvarajv WMV File Can Be Steamed From AnyWhere to AnyWhere Without Downloading it. You Can Watch It Online With Steaming. 2ndly If You Are Talking About FLV Videos Then You Should Refer to Shockwave Flash Control And A Free FLV (SWF) File.
Re: I want to stream movies from remote server to the client, can anyone help me with
can i get files streamed from remote server how do i do coding to retrieve files from the server path which is in remote, i dont want do file sharing, but to connect to server and stream multiple movie files
Re: I want to stream movies from remote server to the client, can anyone help me with
Originally Posted by yuvarajv
can i get files streamed from remote server how do i do coding to retrieve files from the server path which is in remote, i dont want do file sharing, but to connect to server and stream multiple movie files
Bro There Is No Differences B/w File Sharing And Web Sharing.. The Only Differences Is Web Sharing Is Done With Web Server With Http Protocol. And File Sharing is Done With No Protocol Just \\
Re: I want to stream movies from remote server to the client, can anyone help me with
thanks for the reply sam, if i want to play the video file by just clicking on that movie in the client form, i dont want to give the full URL, rather i want give single URL and able to play movie by clicking them, pls help
Re: I want to stream movies from remote server to the client, can anyone help me with
Originally Posted by yuvarajv
thanks for the reply sam, if i want to play the video file by just clicking on that movie in the client form, i dont want to give the full URL, rather i want give single URL and able to play movie by clicking them, pls help
Ok Ok Now I UnderStand What You Are Talking About.ok You Want to Program Mini Web Program.ok i understand you dont want client to get url just open program and select video from list and start watch.. m i correct?
Re: I want to stream movies from remote server to the client, can anyone help me with
Ok let me explain my full project. First of all i have two programsr one for client and one for the server, so when the client connect to server, he/she will get the login form to enter username and password, if the username and password is correct the client gets the form on which he/she has some category of movies based on language, type of movie or by their release date. So when the client click on any movie it should be able to stream it from the server path. Thanks
Re: I want to stream movies from remote server to the client, can anyone help me with
Ok This is database we gonna use In It There are two Table 1 for UserName And Passwords. 2nd for Movies Ok Examine The Database This is For Server Program Ok???