Change video id in youtube embed code with query value - php

what I want to do basically, is to take the parameters from the html page and place it as video ID into the youtube embedded code, so when the page loads, it shows the embedded player of the corresponding video.
How I want it to work, is to have buttons on a web page that will link to a video.html page with the video id in parameters, and load the corresponding video.
I know I probably have to use javascript or php, but I don't know both of them so explain as clearly as possible please. So I want to replace "VIDEOID" with my query string as simply as possible.
<iframe width="560" height="315" src="http://www.youtube.com/embed/"VIDEOID" frameborder="0" allowfullscreen></iframe>
thanks in advance.

Try to follow this code to get parameter value from url in html
Hope its helpful for you..

Related

Is there any way to embed a website in <IFrame>, If it is denying to be embedded?

I want to embed 'www.youtube.com' for example in IFrame Tag of HTML, but as you know it won't allow me to embed it. Is there any way or an alternative way for this action?
First of all, you have to check for the HTTP response header X-Frame-Option of those sites.
If its value is
Deny --> You cannot load the website in IFrame (even if the domain page is the same).
Sameorigin --> Only a page which is in same domain can load this website in IFrame.
I don't know how deep you've tried it, but otherwise you can try the following example:
You can add YouTube videos to your website by using the iframe HTML tags.
Use the youtube site to find the video you want
Click the 'Share' button below the video
Click the 'Embed' button next to the link they show you
Copy the iframe code given and paste it into the html of your web page.
Although YouTube gives you html code using the iframe tag, you can also include your video using the object tag, its up to you. Here is a small example:
<html>
<body>
<iframe src="http://www.youtube.com/embed/..."
width="500" height="300"
frameborder="0" allowfullscreen></iframe>
</body>
</html>

How to hide/encrypt vimeo video URL from source code in PHP?

I have following code
<iframe src="https://player.vimeo.com/video/250356669" width="740" height="370" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" __idm_id__="321146881">
</iframe>
It is my requirement to use only Vimeo videos so my question is how can I encrypt the video URL so that no user able to see that URL from where the video is coming from?
My requirement
<iframe src="something-ecrypted-instead-of-vimeo-url" width="740" height="370" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" __idm_id__="321146881">
</iframe>
Any help will be aprecaited.
Thanks.
Its worth noting firstly that the URL in your example is not a video URL but a URL to HTML 'page' which is inserted into your iframe. This HTML includes the HTML markup, player etc as well as the actual video URL for the video which will play.
If you just want to change your code so the code on your page shows no mention of Vimeo you could have an URL in the source for a proxy on your server which then redirects to the Vimeo URL.
However, as others have pointed out in the comments, this will not really divert or fool anyone who might actually want to understand the page or look at the source as it is very easy to follow the links or to monitor the network activity on a browser. IN very simple terms, if it is sent to your browser then someone can capture it.
If you are concerned with someone copying your material, then the standard approach is not to try to prevent people finding it, but to encrypt it and protect the keys with some sort of DRM mechanism. Vimeo say that they support DRM for 'select Vimeo On Demand partners' - not sure what exactly is needed to qualify for this.

How to display video a url in php?

I'm trying to create a form in which a user inserts their youtube code into a field, which is then stored in mysql.
how can i display video?... while fetching data from my database it displays the video url name
How can I do it so that the link is permanently fixed in the php document and the end part is retrieved from mysql in a way that when the page is opened it displays the video correctly?
Very simple stuff when you know how to do it but I don't so I would appreciate if someone could tell me the way of doing this.
without embed only for example this url which will insert into database "https://www.youtube.com/watch?v=T95zFC4Z2pY" while retiring it by <?php echo $res['link']; ?> is there any other why except embed tag
you can use <iframe></iframe> tag. I hope it will helpful for you.
Try this:
<iframe width="420" height="345"
src="https://www.youtube.com/watch?v=T95zFC4Z2pY">
</iframe>
Since you are not giving an example of any code you have tried so far, I will not provide the code, instead I am going to point you in the direction.
Open up the youtube video Embed Tutorial
Then click on 'Share' under the description, then click on 'Embed'. Youtube will give you the code you need to embed your video.

YouTube embed and PHP

I allowed the user to upload a YouTube embed link that will display the video on their profile page. However, as my current code runs, it does not work. I echoed the field successfully from the database that holds the youtube embed link so I know the php code is working in terms of extracting the link. I then replace the PHP code and put the actual link in the src attribute but it still does not work. Here is the code below.
<iframe width="420" height="315"
src="<?php echo $detailed_profile_data['video_1'];?>"
frameborder="1" allowfullscreen>
</iframe>
The function detailed_profile_data grabs the link the user submitted to the database.This is what it returns. youtu.be/yWk7FOnFvGs
You might want to use oEmbed to find out the actual embeddable URL from the URL that user submits.
This Stack Overflow article might help: How can I retrieve YouTube video details from video URL using PHP?

How do i display a part of the frame?

Here is the image :
So now how do i show only the "Red Boxed" part in my frame.
So is there any way i can position my frame or something to that dimensions ?
The short is that if you want to do it with google, you can't. (show a specific part of it)
To show all of it you can:
<iframe src ="http://google.com" width="100%" height="300">
<p>Your browser does not support iframes.</p>
</iframe>
See iframe
You can modify the width and height but you can't say where to start showing (because it's not you page).
The only thing you can do is put some div over it covering some parts
IMPORTANT, THIS IS JUST AN EXAMPLE
From Google's guidelines: Don’t frame or mirror any Google page (including the page that appears in response to a click on the Google logo or Google search box).
Thanks #Gordon!
Good luck!
with PHP you can retrieve the html and than quite easily edit it pragmatically.
Or try and use HTML FRAME Attributes... http://www.w3schools.com/tags/tag_frame.asp
The latter will only work if you try to get a part of your own page, and not google's..

Categories