QNimate

  • CoursesVideos
  • WP PremiumPlugins
  • DemosLab
  • Home
  • QIdea
  • QTrack
Home Carbon Ads Integrating Youtube in Intel XDK APPs

Integrating Youtube in Intel XDK APPs

intel-xdk-youtube-api

This post is a part 21 of Intel XDK Complete Tutorial post series.

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.

<iframe width="320" height="250" src="//www.youtube.com/embed/[video_id]"></iframe>

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.

https://gdata.youtube.com/feeds/api/videos?alt=json&q=[search_query]

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.

https://gdata.youtube.com/feeds/api/videos/[video_id]?v=2&alt=json

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.

Jan 25, 2015Narayan Prusty
Debugging Intel XDK APPsBest Online Logo Maker
Comments: 1
  1. Fabio
    7 years ago

    Hi,
    I have made a simple app that receives the video ID via JSON, it works perfect on emulator and my smartphone (Android), but when I tried to upload it to Play Store it was reject because are playing the video in background, if I minimize the app, I can hear the video sound track… how to fix it?

    ReplyCancel

Leave a Reply Cancel reply

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

Narayan Prusty

I am a software engineer specialising in Blockchain, DevOps and Go/JavaScript. This is my personal blog where I write about things that I learn and feel interesting to share.

Image8 years ago 1 Comment Cordova
Share this
0
GooglePlus
0
Facebook
0
Twitter
0
Linkedin
  • Embedding Youtube Videos
  • Youtube Search API
  • Retrieving Information of a Single Video
  • More APIs
Related Articles
  • Testing Intel XDK App on iOS Device using Ad Hoc
  • Playing Videos in Intel XDK APP
  • Uploading Files and Showing Progress using Intel XDK
  • Record Video using Intel XDK
  • Publishing Intel XDK App to App Store
Our Sponsor
My Books

2014 - 2015 © QNimate
All tutorials MIT license