I am using iFrame to display video on www.ridesharebuddy.com. I am using autoplay feature in this.
I am doing it this way.
<iframe src="//player.vimeo.com/video/82633004?title=0&byline=0&portrait=0&autoplay=1" width="500" height="320" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
But sometimes it starts even before the whole page is loaded. Can i give some delay in this to load video after 5-10 seconds?
You can append the video link after the page is loaded via jQuery.
<iframe id="vimeo_frame" src="#" width="500" height="320" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<script>
jQuery(window).load(function()
{
var vimeo_frame = jQuery('#vimeo_frame'),
vimeo_src = 'player.vimeo.com/video/82633004?title=0&byline=0&portrait=0&autoplay=1';
setTimeout(function()
{
vimeo_frame.attr('src', vimeo_src);
}, 2000);
}
</script>
Don't forget to include jQuery ;-)
Related
I want to open the maps in new tap when user click on "view larger map"
'gmap'=>array(
array(
'(https*:\/\/maps.google.co.in\/?[^< ]+)',
'<iframe width="'.qa_opt('embed_gmap_width').'" height="'.qa_opt('embed_gmap_height').'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="$1&ie=UTF8&output=embed"></iframe><br /><small>View Larger Map</small>','gmap'
)
),
);
where should I put target="_blank
You should put target="_blank" inside <a> tag. Reference
View Larger Map
Preferably in the <a> tag:
'<iframe width="'.qa_opt('embed_gmap_width').'" height="'.qa_opt('embed_gmap_height').'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="$1&ie=UTF8&output=embed"></iframe><br /><small>View Larger Map</small>',
Hello so I have this code here <iframe frameborder="0" height="550" marginheight="0" marginwidth="0" scrolling="auto" src="http://example.com/signup.php" width="1000"></iframe> now I was wondering is there any way to make a php script that can choose a random iframe code and display the php script on the page for example
<iframe frameborder="0" height="550" marginheight="0" marginwidth="0" scrolling="auto" src="website1.com/signup.php" width="1000"></iframe>
<iframe frameborder="0" height="550" marginheight="0" marginwidth="0" scrolling="auto" src="website2.com/signup.php" width="1000"></iframe>
like in website 1 and 2 but have it so each time a person loads that page it switches from site 1 to site 2 and embeds the php or is that n
You could simplify this easily. Try adding the sites to an array like this:
$sites = array(
'site1.com',
'site2.com',
'site3.com',
'site4.com',
'site5.com',
'site6.com',
'site7.com'
);
Now you can use features like array_rand() to pick a random entry from the site to show in your <iframe>:
<?php
$site_to_use = array_rand($sites);
?>
<iframe frameborder="0" height="550" marginheight="0" marginwidth="0" scrolling="auto" src="<?php echo $sites[$site_to_use]; ?>/signup.php" width="1000"></iframe>
Or you could even use rand() like this:
<iframe frameborder="0" height="550" marginheight="0" marginwidth="0" scrolling="auto" src="<?php echo $sites[rand(0, (count($sites - 1)))]; ?>/signup.php" width="1000"></iframe>
That avoids the hassles of large if else or switch casestatements.
Example
I have a page called 'mas.php' where i retrieve values from database. An IFrame is present in mas.php page. It is defined as follows:
<iframe width="523" height="234" scrolling="No"
width="500" height="145" src="mail-to.php" frameborder="0"
name="myframe" ></iframe>
Now from mail-to.php page I have to navigate to mail.php for mailing.
The sequence is:
(mas.php-->mail-to.php[iframe]--->mail.php)......
here while using the iframe in 'mas.php' page can i navigate to 'mail-to.php' by defining id in iframe?
<iframe width="523" height="234" scrolling="No"
width="500" height="145" src="mail-to.php?id=<?php echo $row['id'];?>"
frameborder="0" name="myframe" ></iframe>
How can I get the video ID for youtube and vimeo videos embed code? A youtube video embed code looks like this:
<iframe width="560" height="315" src="http://www.youtube.com/embed/dbPmWbqAJPs" frameborder="0" allowfullscreen></iframe>
where the ID in this is dbPmWbqAJPs.
A vimeo embed code looks like this:
<iframe src="http://player.vimeo.com/video/62468031?color=00ff00" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
where the ID in this example is 62468031.
I don't want to replace those exact ids, but rather have a pregmatch/pregreplace that finds the id in any embed of vimeo and of youtube.
try this
vimeo
$string='<iframe src="http://player.vimeo.com/video/62468031?color=00ff00" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
preg_match_all( '~http://player.vimeo.com/video/(.*?)\?~si',$string,$M);
echo ($M[1][0]);
youtube :
$string='<iframe width="560" height="315" src="http://www.youtube.com/embed/dbPmWbqAJPs" frameborder="0" allowfullscreen></iframe>';
preg_match_all( '~http://www.youtube.com/embed/(.*?)\"~si',$string,$M);
echo ($M[1][0]);
Try below code for php, it works without pregmatch
i.e. :
http://vimeo.com/22222222
http://player.vimeo.com/video/22222222
http://vimeo.com/channels/staffpicks/22222222
http://vimeo.com/groups/groupsname/22222222
PHP Code :
$vimeoUrl = 'http://vimeo.com/channels/channelsName/22222222';
$fetchVimeoIdArr = explode('/', $vimeoUrl);
$idCounter = count($fetchVimeoIdArr) - 1;
$vimeoId = $fetchVimeoIdArr[$idCounter];
I have this following code where i cannot play the player in second iframe from first iframe . Although this works fine if the link to play song is in the main page and not inside the first iframe
<script type="text/javascript">
function music(dir) {
alert(dir);
var iframe = document.getElementById("player");
iframe.src = dir;
}
</script>
<iframe src="home.php" frameborder="0" scrolling="no" width="100%" height="100%" style="background:#993333"></iframe>
<iframe id="player" src="player.php" frameborder="0" scrolling="no" width="400px" height="100px" style="background:#66FF99"></iframe>
//home.php
<a href="#" onclick="return music('player.php?item=test2')" >Song2</a>
//player.php
<object type="application/x-shockwave-flash" data="dewplayer.swf?mp3=mp3/music.mp3&autostart=1" width="200" height="20" id="dewplayer"><param name="wmode" value="transparent" />
</object>
Example:
main.php
<script type="text/javascript">
function music(dir) {
alert(dir);
var iframe = document.getElementById("player");
iframe.src = dir;
}
</script>
<iframe src="home.php" frameborder="0" scrolling="no" width="100%" height="100%" style="background:#993333"></iframe>
<iframe id="player" src="player.php" frameborder="0" scrolling="no" width="400px" height="100px" style="background:#66FF99"></iframe>
player.php
<?php if(!empty($_GET['item'])){echo '<div>item = '.$_GET['item'].'</div>';} ?>
<object type="application/x-shockwave-flash" data="dewplayer.swf?mp3=mp3/music.mp3&autostart=1" width="200" height="20" id="dewplayer"><param name="wmode" value="transparent" />
</object>
home.php
<a href="#" onclick="parent.music('player.php?item=test2')" >Song2</a>
First iframe doesn't have an ID.
Both those iframes are not part of each other's document. So if you have to change url of one from the other you have to bring in parent in the picture.
You could use the new window.postMessage API to send a message from one remote frame to it's parent, and then have the parent window proxy that make message back to the other iframe by passing that message onto the other iframe.
For documentation on this, see the Mozilla page (https://developer.mozilla.org/en-US/docs/DOM/window.postMessage)