最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I hide YouTube play button appearing on the video? - Stack Overflow

programmeradmin2浏览0评论

I want to get rid of you tube play button you see on image, and also this first frame if possible.

I want to use my own play button, and my own first frame as img tag, which actually is already there, and working. But when I run API playVideo() method, then I hide my play button and first frame, and I see (for few moments) that there is youtube play button and youtube first frame which you can see on attached image. And after this few moments it disappears, and shows loading gif.

I want to get rid of you tube play button you see on image, and also this first frame if possible.

I want to use my own play button, and my own first frame as img tag, which actually is already there, and working. But when I run API playVideo() method, then I hide my play button and first frame, and I see (for few moments) that there is youtube play button and youtube first frame which you can see on attached image. And after this few moments it disappears, and shows loading gif.

Share Improve this question asked Feb 17, 2012 at 1:25 KarolKarol 8,06312 gold badges51 silver badges68 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

I found it not possible. So the only way to hide Play button is to place video image above the video which can be fetched from youtube. See this link.

Add a button for save video

<asp:Button ID="buttonInsert" runat="server" Text="Add video" OnClick="buttonInsert_Click"/>

Take a hidden field for hold the value of image.

<asp:HiddenField ID="VideoId" runat="server" ClientIDMode="Static" />

Write the javascript code as follows to get the image

<script type="text/javascript">
$(document).ready(function () {
 $("#buttonInsert").click(function () {
    var youtubeid = $("#textBoxScript").val().match(/[\w\-]{11,}/)[0];
    $("#VideoId").val("http://i1.ytimg./vi/" + youtubeid + "/0.jpg")
    });
});
</script>

Save the value of hidden fiels in to database.

   protected void buttonInsert_Click(object sender, EventArgs e)
    {
        try
        {           
           string ThumbnailImage = VideoId.Value;
           //save ThumbnailImage into database 
           //and when you get video list you will get as a image. 
           //on that image you can also add Play icon                            
        }
        catch
        { }
    }
发布评论

评论列表(0)

  1. 暂无评论