Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hyperlink to play youtube video

Is it possible to create a hyperlink on your web page that can play an embedded youtube video on the same page.?

like image 706
neojakey Avatar asked Sep 01 '10 01:09

neojakey


People also ask

Can you hyperlink a YouTube video?

YouTube allows video creators to link out to other sites and content that they own. In order to add clickable links to your YouTube videos, you'll need to verify that you own the site you're linking to. Additionally, you'll need to join YouTube's Partner Program (if it's available in your country).

How do I turn a video into a clickable link?

How to create a link for a video file using Google Photos? Tap the Upload button then select the Computer or Google Drive and upload a video you want to make a link for. Paly the video, and click the Share buttonon the top right corner. Choose the Create link > Create link, and click the Copy to get the video link.

How do I open a link to a YouTube video?

Go to "Settings > Apps > ⁝ > Default Apps > Set as Default > YouTube > Go to Supported URLs > In this app". Your phone may look different with options like "Opening Links" and "Open supported Links" instead. Tap those options to continue.


1 Answers

you can easily do this with the Youtube Player API

If you have a read through that document, you'll see it's pretty easy to have your own controls and extend the player.

Example

// Get element holding the video (embed or object)
var player = document.getElementById("myYouTubePlayer");

//Create a simple function and check if player exists
function play() {
    if(player) {
        player.playVideo();
    }
}

Then in your HTML simply

<a href="#" onclick="play()">Play Youtube Video</a>
like image 185
Marko Avatar answered Oct 25 '22 20:10

Marko