Page 1 of 2
How to get fluid Youtube/Vimeo embeds?
Posted: Thu Sep 19, 2013 8:49 pm
by Gregory Vaughan
I've followed these instructions to embed a youtube video
http://docs.appery.io/documentation/b...
changing the last bit to .appendTo('.ui-content'); per a suggestion on this forum, but
But this assumes known dimensions for width and height and one size does not fit all on mobile.
How do I embed a youtube video so that the player is full screen on all devices?
I have tried using this:
https://github.com/davatron5000/FitVi...
as a user defined external resource (downloaded to my web server) and
$('.myFrame').fitVids(); or $('.ui-content').fitVids();
in an OnLoad before (or after) the youtube embed code from the sample. No love.
How to get fluid Youtube/Vimeo embeds?
Posted: Thu Sep 19, 2013 9:48 pm
by Alena Prykhodko
Hello!
1) Create New JS asset with code from https://raw.github.com/davatron5000/F...;
2) Add on page HTML component with name panelName;
3) Add Button;
4) On Click event add Run JS with the following code:
preAppery("panelName").html('<iframe width="425" height="349" src="http://www.youtube.com/embed/FKWwdQu6_ok" frameborder="0" allowfullscreen></iframe>');
$('.ui-content').fitVids();/pre
How to get fluid Youtube/Vimeo embeds?
Posted: Thu Sep 19, 2013 10:15 pm
by Gregory Vaughan
Thank you Alena, that is helpful.
It scales to full width now, but the height does not scale properly in landscape views. But that would seem to be an issue for FitVids, as it is clear your code is working!
Thanks again for your help.
How to get fluid Youtube/Vimeo embeds?
Posted: Tue Nov 05, 2013 5:35 am
by Robert Larsen
Could you provide more details in your steps I am confused.
How to get fluid Youtube/Vimeo embeds?
Posted: Tue Nov 05, 2013 5:41 am
by Alena Prykhodko
Hello Robert! What did you try and what is not clear?
How to get fluid Youtube/Vimeo embeds?
Posted: Tue Nov 05, 2013 5:45 am
by Robert Larsen
1) Create New JS asset with code from
How do you create a new js asset?
2) Add on page HTML component with name panelName;
I see how I can add an html box to my UI, but what is the purpose of this and what do I do with it?
4) On Click event add Run JS with the following code:
I assume you set this event to run when clicking on the button added in step 3.
How to get fluid Youtube/Vimeo embeds?
Posted: Tue Nov 05, 2013 5:50 am
by Alena Prykhodko
1) Create New- JavaScript- Create JavaScript
2) You refer to HTML component when do Run JS
4) Yes, you are right
How to get fluid Youtube/Vimeo embeds?
Posted: Tue Nov 05, 2013 6:21 am
by Robert Larsen
Lol, I apologize. I have figured out step one and created the java script code. But step 2 still has me confused, what do you mean by refer to the html component?
How to get fluid Youtube/Vimeo embeds?
Posted: Tue Nov 05, 2013 6:30 am
by Robert Larsen
Ok, I figured out step two now actually. But when I click my button my video shows in the html space, but it has scrollers to each side I thought that this setup would make it default to full screen.
How to get fluid Youtube/Vimeo embeds?
Posted: Tue Nov 05, 2013 2:59 pm
by Maryna Brodina
Hello! In code pre"http://www.youtube.com/embed/FKWwdQu6_ok" frameborder="0" allowfullscreen></iframe>');/pre please check $('.ui-content').fitVids(); - parameters width="425" height="349" should be the same as html component Dimension (Dimension should be set in px)