How to display videos from YouTube channel?
I had YouTube Channel and I Had Web Page on my web site which display this video ,I diplay the viedo in ModalPopupExtender ,and I had problem when I finsihed from displaying this video and close ModalPopupExtender the sound of viedo still displaying.
So please any one help me.
开发者_JS百科 ' id="Image" runat="server" width="96" height="86" alt="Video" />
'> ' type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="320"> Close <%----%> <%----%> ' />protected void Page_Load(object sender, EventArgs e) { string LanguageID = Globals.GetSuitableLanguage(Page); Page.Title = Globals.Translate(Page.Title, Page); if (!IsPostBack) { GetAllYouTube(); }
} private void GetAllYouTube() { using (SqlConnection con = Connection.GetConnection()) { string Sql = "select id,url,Image, " + Globals.Translate("YoutubeTitle_EN", Page) + " from [YouTubeVideos] Where MV='Yes'" ; SqlCommand Com = new SqlCommand(Sql, con); Com.CommandType = CommandType.Text;
SqlDataReader dr = Com.ExecuteReader();
DataList2.DataSource = dr;
DataList2.DataBind();
}
}
Because the only thing you do is to change the visibility of your div which contains the youtube player, the video will keep playing till end. You need to use youtube javascript player api to control the player and stop video with command "player.stopVideo():Void" when user closes the modal popup.
Please review http://code.google.com/apis/youtube/js_api_reference.html#Functions for further information and examples.
精彩评论