0

I want to add an auto select one iframe "which is running" between two to play videos on my website. I need decision block in PHP/JavaScript to automatically choose 1 iframe from the two. In some countries the videos plays from one iframe and in other countries it plays from both iframes.

So I want to add a way so any user from anywhere can watch videos.

Normally I'm using this one directly

<div id="video" style="margin-top:10px;"><iframe width="940" height="420" src="http://www.youtube.com/embed/<?php echo $_GET['v'] ;?>?autoplay=1&vq=medium&modestbranding=1&showinfo=0" frameborder="0" allowfullscreen></iframe>

But now I want to add one more iframe, which is here

<div id="video" style="margin-top:10px;"><iframe width="940" height="420" src="http://www.v.ytapi.com/embed/<?php echo $_GET['v'] ;?>?autoplay=1&vq=medium&modestbranding=1&showinfo=0" frameborder="0" allowfullscreen></iframe>

plz help me. thanks, Medipalace

Ozair Patel
  • 1,658
  • 1
  • 12
  • 17
  • 1
    Do you know which video to display server-side? If so, that's PHP. If you only know this client-side, you need Javascript. Which is it? – Ruben Martinez Jr. Dec 30 '14 at 01:51
  • Also you need to show us what you have tried and detail specificallt what isnt working or what you cannot figure out. – prodigitalson Dec 30 '14 at 02:04
  • Dear i wants this that if someone click on a video for watch it than first iframe automatic work for play video.if not than automatic second iframe should work.like if else – Medipalace Dec 30 '14 at 04:25
  • or you can help me by write a code some like this.if any user come from these location(pakistan,uae etc) than iframe 1 works,and for all other countries iframe 2 should automatic work – Medipalace Dec 30 '14 at 04:27

1 Answers1

0

You can find many responses to know the country in this post: PHP - Detect country

For example you can use the api hostip

$country = '';
$IP = $_SERVER['REMOTE_ADDR'];
if (!empty($IP)) {
$country =                  file_get_contents('http://api.hostip.info/country.php?ip='.$IP);
 }

After you can test the country : if($country== "england") { // your code }

Community
  • 1
  • 1