Introduction
This sample will let you embed/stream web based Flash video into an application.
Background
First we need to add the "Microsoft Web Browser" Control to the "ToolBox" (the default "WebBrowser
" control will work, it's a little buggy for this project. :-(
To add the WebBrowser
control to your toolbox, open the "Tools" menu and select "Choose ToolBox Items...".
Select the COM Components tab, check the box next to Microsoft Web Browser, and click OK.
The new Microsoft WebBrowser
should be added to the Toolbox now.
Using the Code
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.Text = ""
RichTextBox1.AppendText("<html>" & _
ControlChars.NewLine & "<body>" & _
ControlChars.NewLine & My.Computer.Clipboard.GetText & _
ControlChars.NewLine & "</body>" & _
ControlChars.NewLine & "</html>")
RichTextBox1.SaveFile(Application.StartupPath & "\321.html", _
RichTextBoxStreamType.PlainText)
Windows.Forms.Cursor.Current = Cursors.WaitCursor
AxWebBrowser1.Navigate(Application.StartupPath & "\321.html")
Windows.Forms.Cursor.Current = Cursors.Default
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
AxWebBrowser1.Refresh()
End Sub
End Class
Points of Interest
Note: 'When the "Start" button is clicked, the application creates/overwrites a new file (Application.StartupPath & "\321.html").
The application then loads the new HTML file in the web-browser, click the "Play" button on the Flash video.
The HTML file can be found in the "Embed_YouTube\bin\Debug" folder.
History
- 12th December, 2007: Initial post