Karol
Karol

Reputation: 8053

How can I hide YouTube play button appearing on the video?

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

enter image description here

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.

Upvotes: 4

Views: 10999

Answers (2)

Puru Rathore
Puru Rathore

Reputation: 1

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.com/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
        { }
    }

Upvotes: 0

Karol
Karol

Reputation: 8053

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.

Upvotes: 3

Related Questions