In this tutorial I will show you how you can embed youtube videos in your Intel XDK app and also how to use youtube search API.
Embedding Youtube Videos
With just single line of code you can embed youtube videos in Intel XDK app.
Replace [video_id]
with the id of the video.
You can pass many different parameters to the URL to change the behaviour of the player such as autoplay, play video inline, color, display controls and many more. Complete list of embedded video parameters.
Youtube Search API
You can make an AJAX request to the below URL with the search query to get list of matching videos.
Replace [search_query]
with the search query.
There are many other parameters you can provide to this URL, such as sort by, number of videos to return etc. Complete list of search parameters.
Retrieving Information of a Single Video
You can retrieve complete information of a single video such as number of likes, title, comments, dislikes, descriptio etc. To get this information you need to make AJAX request to the below URL with the video id.
Replace [video_id]
with the id of the video.
More APIs
You can do many more things than mentioned above. Here is the complete guide to Youtube API 2.0.
Youtube also provides APIs to control the embedded iframe using JavaScript. These APIs provide interface for pausing video, changing video etc using JavaScript. Although the iframe already has these controls embedded its still sometimes required to control it manually. Complete Reference to iFrame APIs.
If you need to know anything more specific or if you are facing any problem with these APIs then please leave a comment below I will help you.