Visual Studio .NET - Video Streaming in ASP.Net

Asked By Munendra Maheshwari on 29-Dec-08 05:45 AM


I am working in 3.5 and in my project I have to apply the video streaming just like in youtube's videos. How can I do that? Can any one give me any idea for that with code.

Munendra Maheshwari

read this - C_A P replied to Munendra Maheshwari on 29-Dec-08 06:27 AM

Ways to Display Video
There are three basic ways to display video on a Web form:
a. As an img HTML element using the dynsrc attribute
b. As an embedded video using the embed HTML element to insert the user' s default media player on the page
c. As an ActiveX object using the object HTML element to insert a specific media player on a page

As with audio, each of these approaches has advantages and disadvantages. The following sections explore these techniques in more detail.
1. Using the img Element
The easiest way to display a video on a Web form is to include the video as an HTML img element. The dynsrc attribute of the img element allows you to specify a video file to display in the element, as shown here:

<img dynsrc="clock.avi">
The Image and ImageButton server controls and the Image and Image Button HTML controls all support the dynsrc attribute. For example, the following HTML displays a video in an ImageButton control:

<asp:ImageButton id="ImageButton1" dynsrc="clock.avi"


However, the dynsrc attribute has the following limitations:
It is not supported by Netscape Navigator.
It accepts only AVI (Audio Video Interleaved) format files.
It cannot be controlled from client-side scripts the way that videos included as ActiveX objects can.
2. Embedding Videos
Use the embed HTML element to display a video on a Web form with the user' s default media player. For example, the following HTML embeds a video on a page:

<embed src="clock.avi" id="aviTest" hidden="false" height="200" width="200"

autostart="false" type="video/avi" loop="true"></embed>

Embedded videos are displayed using the plug-in that is registered for the media type. Using the embed HTML element to display video has the following advantages: It is supported by most browsers, including Internet Explorer and Netscape Navigator. The user can control the playback using the controls of the embedded media player. Multiple video formats can be displayed.
The disadvantage of using the embed HTML element is that it doesn' t provide the level of scripting support that you can get from an ActiveX object.

3. Using ActiveX objects is more complicated and please let me know if you realy need this.

try this link - C_A P replied to Munendra Maheshwari on 29-Dec-08 06:29 AM


Re :: Video Streaming in - SP replied to Munendra Maheshwari on 29-Dec-08 06:52 AM

The users can post the YouTube Video URL into your system.

You can use the below codes to achieve it.

    <object width="425" height="355"><param name="movie" value="YouTube Video Link"></param><param name="wmode" value="transparent"></param>
    <embed src="YouTube Video Link" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355">

You should retrieve the YouTube Video Link from your database and use ClientScript to register the above code snippet in CodeBehind.

See the following forum articles, you may get some information about
implementing you tube video on your site.


Hope it helps.
Re :: Video Streaming in - SP replied to Munendra Maheshwari on 29-Dec-08 07:15 AM

See the following link for a forum discussion for saving Video file in database

Also there are some other articles,

Hope it helps.

Video Streaming - mv ark replied to Munendra Maheshwari on 30-Dec-08 03:23 AM
For ASP.NET web apps, Silverlight is best suited for streaming video like the YouTube videos
Check these links for more info -
Video Streaming - Bjorn Young replied to Munendra Maheshwari on 09-Jul-09 03:14 PM

Not sure if you work in Visual studio 2005/2008; however, if you do:

1) Forget the coding

2) Go to design mode

3) Insert a media player (drag-drop from the tool box)

4) define the stream's url in the Properties window.

5) End of story :o)