C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






A Simple Video Player Control - Uses


Posted Date: 03 Aug 2008    Resource Type: Code Snippets    Category: ASP.NET WebForms

Posted By: Gaurav Arora       Member Level: Gold
Rating:     Points: 10



In my previous post, I presented a Video Player Custom control which plays all types of streaming media. Here I am presenting a simple way to apply the same custom control in web application.

File Name : VideoPLayerCustomControl.aspx




<%@ Page Language="C#" AutoEventWireup="true" CodeFile="VideoPLayerCustomControl.aspx.cs"
Inherits="VideoPLayerCustomControl" %>

<%@ Register TagPrefix="whPlayer" TagName= "vaPlayer" Src="~/videoPlayer.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Video Player Using Custom Control</title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<whPlayer:vaPlayer ID="videoPlayer" autoStart="true" runat="server" />
<br />
<asp:ValidationSummary id="valSumm" runat="server" />
<asp:Label ID="lblVideoName" Text="Enter Video Name" runat ="server" />
<asp:TextBox ID="txtVideoName" runat="server" EnableViewState="true" Text="D:\Videos\AVSEQ06.DAT" />
<asp:Button ID="btnPlayVide" runat="server" OnClick="btnPlayVide_Click" Text="Play Video" />
<asp:RequiredFieldValidator id="rfvtxtVideoName" ControlToValidate="txtVideoName" text="*" ErrorMessage="Please eneter Video to play" runat="server" />

</div>
</form>
</body>
</html>


File Name : VideoPLayerCustomControl.aspx.cs



/* This Example is a part of different
* examples shown in Book:
* C#2005 Beginners: A Step Ahead
* Written by: Gaurav Arora
* Reach at : g_arora@hotmail.com */
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class VideoPLayerCustomControl : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["sourceUrl"] != null)
this.videoPlayer.sourceUrl = Convert.ToString(Request.QueryString["sourceUrl"]);

videoPlayer.autoStart = true;
videoPlayer.height = "300";
videoPlayer.width = "300";
}

protected void btnPlayVide_Click(object sender, EventArgs e)
{
if(IsValid)
Response.Redirect("videoplayercustomcontrol.aspx?sourceUrl=" + txtVideoName.Text);

}
}


Steps to run the application
1. Open VS2005
2. Select New Web application

3. Add new Page from existing pages and browse to attachment
4. Run the applcation by prssing F5

OR

3. If not want to add new page just copy and paste the content from above, code(s)
4. Make sure all contents would be copied and then press F5

and then Enjoy the video...

Attachments

  • A Video Player Application (20032-31134-VideoPLayerCustomControl.aspx)
  • Vide Playe -application (20032-31136-videoPlayer.ascx.cs)



  • Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Web  .  VideoPlayer  .  Video Player using ASP.NET  .  Video player custom control using ASP.NET  .  Video player custom control  .  Interview  .  Custom Video Player control using ASP.NET  .  Asp.net  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: A Simple Video Player - Construction
    Previous Resource: Creating Captcha Page in ASP.Net
    Return to Discussion Resource Index
    Post New Resource
    Category: ASP.NET WebForms


    Post resources and earn money!
     
    Related Resources



    dotNet Slackers   BizTalk Adaptors    Web Design

    it help desk

    Contact Us    Privacy Policy    Terms Of Use