Click here to Skip to main content
12,635,139 members (24,774 online)
Click here to Skip to main content
Add your own
alternative version

Stats

27.6K views
721 downloads
17 bookmarked
Posted

Embed Web Video

, 12 Dec 2007 CPOL
Rate this:
Please Sign up or sign in to vote.
Embed Web Video in your desktop application
Screenshot - 1.JPG

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
'Start Button Click Event

Private Sub Button1_Click(ByVal sender As System.Object, _
	ByVal e As System.EventArgs) Handles Button1.Click

'Clear out the RTB to receive the new HTML 
RichTextBox1.Text = ""

'Create the HTML with the Embedded code, from the Clipboard
RichTextBox1.AppendText("<html>" & _
ControlChars.NewLine & "<body>" & _
ControlChars.NewLine & My.Computer.Clipboard.GetText & _
ControlChars.NewLine & "</body>" & _
ControlChars.NewLine & "</html>")

'Save/Overwrite the HTML file
RichTextBox1.SaveFile(Application.StartupPath & "\321.html", _
	RichTextBoxStreamType.PlainText)

'Show the WaitCursor
Windows.Forms.Cursor.Current = Cursors.WaitCursor

'Load the new HTML file into the browser, so we can watch the video in our app.
AxWebBrowser1.Navigate(Application.StartupPath & "\321.html")

'Show the default Cursor
Windows.Forms.Cursor.Current = Cursors.Default
End Sub

'Refresh Button Click Event
Private Sub Button2_Click(ByVal sender As System.Object, _
	ByVal e As System.EventArgs) Handles Button2.Click

'Refresh the browser, also stops/rewind the video
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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

cannalane
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

 
QuestionWhat should happen when I haven't install Adobe Flash Player addons ? Pin
utkarshdshah12-Dec-11 19:13
memberutkarshdshah12-Dec-11 19:13 
Questionwhy did the chicken cross the road? Pin
adamlilll26-Jan-10 22:21
memberadamlilll26-Jan-10 22:21 
GeneralThanks Pin
cannalane21-Dec-07 6:17
membercannalane21-Dec-07 6:17 
QuestionWhere is the sourcecode? Pin
knoami12-Dec-07 6:29
memberknoami12-Dec-07 6:29 
GeneralRe: Where is the sourcecode? Pin
cannalane12-Dec-07 9:00
membercannalane12-Dec-07 9:00 
GeneralRe: Where is the sourcecode? Pin
F16I12-Dec-07 17:39
memberF16I12-Dec-07 17:39 
GeneralRe: Where is the sourcecode? Pin
knoami12-Dec-07 21:23
memberknoami12-Dec-07 21:23 
GeneralRe: Where is the sourcecode? Pin
cannalane14-Dec-07 7:38
membercannalane14-Dec-07 7:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.161208.2 | Last Updated 12 Dec 2007
Article Copyright 2007 by cannalane
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid