Youtube Data API v3 - Disable playlist controls - php

I'm currently creating this website that has a space for a 200x200 video player only, so I need to reduce the amount of clutter there is on the "video control panel".
This is how the Player looks like right now, I need to remove the |< & >| buttons
Thanks!
Snippet:
<iframe id="ytplayer" type="text/html" width="200" height="200" src="https://www.youtube.com/embed/?listType=playlist&list={PLAYLISTIDHERE}" >

It may depend on your code, but you can try "controls=0", as in:
http://www.youtube.com/embed/$VIDEOID?controls=0
where you replace $VIDEOID with a valid video ID.
Note, that this will also remove the slider to go forward and backward within the video during playing.
To remove also the related videos at the end, after playing, add the parameter "rel=0", as in:
http://www.youtube.com/embed/$VIDEOID?controls=0&rel=0
See for a list of available parameters:
https://developers.google.com/youtube/player_parameters
Try:
<iframe id="ytplayer" type="text/html" width="200" height="200" src="https://www.youtube.com/embed/?controls=0&listType=playlist&list={PLAYLISTIDHERE}" />
Seems the playlist selection does show at left top corner but is not working anymore with controls=0.
An option might be to use autohide=1. I also added modestbranding=1 as suggested.
<iframe id="ytplayer" width="200" height="200" src="https://www.youtube.com/embed/?modestbranding=1&autohide=1&listType=playlist&list={PLAYLISTIDHERE}" />

Is not possible. However you can remove the youtube logo on the playerbar to get some room.
Add the parameter modestbranding=1 to your request
Example http://www.youtube.com/embed/KMoWVujxJgg?modestbranding=1

Related

Embedded video player not showing and not playing a video file

I am developing a PHP backend to my mobile app.
There is a part where I need to show and play a hosted video file.
This is how am I trying it:
$data[$i]['video'] = '<video controls width="500", height="300><source src="pacientes/'.$data[$i]['video'].'" type= "video/mp4; codecs="avc1.42E01E, mp4a.40.2"></video>';
Here hou have the value for $data[$i]['video'] that should be an example of the kind of video files I will find in he backend
32365bec-7ec8-4b16-a91c-58e12f68cdba1575964120438935622.mp4
And here yoy have the video file URL
https://capenergy-app.com/administrar/application/admin/pacientes/32365bec-7ec8-4b16-a91c-58e12f68cdba1575964120438935622.mp4
And here you a screenshot from the video player using the above code to show it.
The video is not played when clicking on the play button, and the video duration is set to 0:00.
What do I need to change to my code to show the video and let me play it?
You must put the full video path at the source's src
<source src="full_path" > </source>
Double check spelling, for example: some " are missing. And there is no need to add a , after attributes.
Fix:
$data[$i]['video'] = '<video controls width="500" height="300"><source src="pacientes/'.$data[$i]['video'].'" type= "video/mp4"; codecs="avc1.42E01E, mp4a.40.2"></video>';

Auto click on button like in ifarme when page load

If I wanted to auto-click a button element in ifarme how would I go about this working ?
function autoclick() {
document.getElementById('u_0_4').contentWindow.document.getElementById("u_0_5").click()
}
<div onload="autoclick()" >
<iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fweb.facebook.com%2FMaherZain&width=450&layout=standard&action=like&size=small&show_faces=true&share=true&height=80&appId=788255487990117" width="450" height="80" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" id="u_0_4" ></iframe>
</div>
=====> if have any other way for do that please tell me :(
You cannot do that because otherwise people would just embed a 1x1 iframe and have every visitor "Like" whatever the author wanted. It's a security issue to let different origins have access to the contentWindow of iframes pointing to a different origin.
Imagine if you were able to do that. People could just start embedding gmail or your banking website in a 1x1 iframe and then trigger a few clicks and keyboard events to reset your password.

Embedded videos don't show up

I have a web site I'm working on and for some reason some of my videos don't display. The first videos display but the next one's don't.
So first one looks like this:
And the rest look like this:
I know the url's I am using are correct, I dump them to the screen and navigated to them to make sure they weren't broken. This is in chrome, same thing happens in IE.
This is the code I am using to embed:
<iframe width="420" height="315" alt="Jesus Culture" src="<?=$row?>"
frameborder="5" allowfullscreen></iframe>
I'm using similar code to yours for multiple videos on one page,
i.e.
<iframe width="425" height="349" src="http://www.youtube.com/embed/video-code" frameborder="0" allowfullscreen=""></iframe>
Make sure that your urls have the embed format. Also try to place the src value hardcoded (no php) to check whether in that case displaying multiple videos on the page will be an issue.

1 Image URL saved on database (but different versions available on the main server): how to replace a letter on the fly to avoid image scaling?

this is the situation: i have a supplier who gives me 1 URL image only for the catalogue...for example the large version
that is: http://www.domain.com/dev/1/1/08973911/l_08973911.jpg
This image URL on database is saved into the field: supplier_reference ...
so i can call the img src with:
<img src="{$product.supplier_reference|escape:'htmlall':'UTF-8'}" width="150" height="133" />
and all is ok 'cause it scales... but i don't want it to scale.
Sometimes, as in this case, i don't need the large version but this kind of small 150x133...
the correct URL i need will be:
http://www.domain.com/dev/1/1/08973911/s_08973911.jpg that is the s version.
How can i do to replace only that letter for the URL taken from the DB?
Thank you very much.
It seems that you are using Smarty. If so, you can use Smarty's replace variable modifier:
<img src="{$product.supplier_reference|replace:'/l_':'/s_'|escape:'htmlall':'UTF-8'}"
width="150" height="133" />
$url = preg_replace('#l(_\w+\.jpg)#', 's\1', $url);

accessing images

I am new to Symfony.
I created a layout page in which I have this :
<img src="images/header.jpg" width="790" height="228" alt="" />
but the image isn't displayed in the page when accessed from the browser.
I put the file header.jpg in the web/images/ folder.
I thought I could learn Symfony in a week while working on a small project. is it possible ?
Use slash at the beginning like
<img src="/images/header.jpg" width="790" height="228" alt="" />
You can also use image_tag (which is better for routing)
image_tag('/images/header.jpg', array('alt' => __("My image")))
In the array with parameters you can add all HTML attributes like width, height, alt etc.
P.S. IT's not easy to learn Symfony. You need much more time
If you don't want a fully PHP generated image tag but just want the correct path to your image, you can do :
<img src="<?php echo image_path('header.jpg'); ?>"> width="700" height="228" alt="" />
Notice that the path passed to image_path excludes the /images part as this is automatically determined and created for you by Symfony, all you need to supply is the path to the file relative to the image directory.
You can also get to your image directory a little more crudely using
sfConfig::get('sf_web_dir')."/images/path/to/your/image.jpg"
It should be noted that using image_tag has a much larger performance cost attached to it than using image_path as noted on thirtyseven's blog
Hope that helps :)

Categories