【问题标题】:How to display videos from YouTube channel?如何显示来自 YouTube 频道的视频?
【发布时间】:2010-12-07 09:53:07
【问题描述】:

我有 YouTube 频道,我的网站上有显示此视频的网页,我在 ModalPopupExtender 中显示视频,当我完成显示此视频并关闭 ModalPopupExtender 时出现问题,视频的声音仍在显示。

所以请任何人帮助我。

' id="Image" runat="server" width="96" height="86" alt="Video" />

'> ' 类型="应用程序/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="320">

关闭
' />

protected void Page_Load(object sender, EventArgs e) { 字符串 LanguageID = Globals.GetSuitableLanguage(Page); Page.Title = Globals.Translate(Page.Title, Page); 如果(!IsPostBack) { GetAllYouTube(); }

} 私人无效GetAllYouTube() { 使用 (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();

    }
}

【问题讨论】:

  • 你有我们能看到的代码吗?

标签: asp.net youtube


【解决方案1】:

因为您唯一要做的就是更改包含 youtube 播放器的 div 的可见性,因此视频将一直播放到结束。当用户关闭模式弹出窗口时,您需要使用 youtube javascript player api 来控制播放器并使用命令“player.stopVideo():Void”停止视频。

请查看http://code.google.com/apis/youtube/js_api_reference.html#Functions 以获取更多信息和示例。

【讨论】:

    猜你喜欢
    • 2014-10-25
    • 2013-06-20
    • 2018-02-02
    • 2015-11-03
    • 1970-01-01
    • 2015-11-27
    • 1970-01-01
    • 2014-06-06
    • 2018-02-07
    相关资源
    最近更新 更多