Welcome, Guest Login

Support Center

Play YouTube Videos

Last Updated: May 09, 2017 11:15AM EDT
Play YouTube Videos

Introduction

You can use YouTube videos in iOS, Android and HTML5 apps using the following code:


Instal Tutorial App

Click here to install the Play YouTube Video Tutorial app in your workspace. 


HTML Embed

To play YouTube video we use the YouTube embed HTML available on YouTube site under 'Share' :

<iframe width="560" height="315" src="https://www.youtube.com/embed/z5M0PeLQFys" frameborder="0" allowfullscreen></iframe>

The HTML is pasted in the HTML Block of the 'Play Your tube Video' view of the app.






Here is the detail of the HTML.
We do capture the device Width and Height to calculate our iFrame, feel free to change this as you see fit:



We include some EachScape JavaScript libraries to execute custom script from JS.
You are now ready to play YouTube video.


HTML Code Example

<!DOCTYPE html> 
<html> 
<head> 
<style type="text/css"> 
iframe {width: [[sys:devicePortraitWidth]]px !important; height: [[sys:devicePortraitWidth:div 5|mul 3]]px !important; } 
a {
    color: #00CED1;
}
</style>
<script type="text/javascript" src="es-jquery-1.7.min.js"></script>
<script type="text/javascript" src="es_js_api.min.js"></script>
</head> 

<body>

<iframe id="myYoutubeIframe" src="https://www.youtube.com/embed/[[ds:/YouTube - EachScape Channel Links (Cloud Collection)/record/youtube_video_ID]]" frameborder="0">
</iframe>

<script type="text/javascript" src="http://www.youtube.com/iframe_api">
</script>

</body> 
</html>

Learn More
- Introduction to using JavaScript in EachScape
- Execute EachScape Custom Script from JavaScript

Help us improve! Rate this article:

Yes I found this article helpful

Ask a Question   

support@eachscape.com
http://assets0.desk.com/
false
eachscape
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete