Hi atulb,
if it is your own server then it is easy and you don't have to change xhr.js
Just put a file on the server in YouTube format and in JSON (not XML):
http://example.com/my-playlist.json
Code: Select all
{
"version": "1.0",
"encoding": "UTF-8",
"feed": {
"id": {
"$t": "http://gdata.youtube.com/feeds/api/users/karaoke/uploads"
},
"updated": {
"$t": "2012-06-13T08:34:22.265Z"
},
"title": {
"$t": "Uploads by karaoke",
"type": "text"
},
"openSearch$totalResults": {
"$t": 5
},
"openSearch$startIndex": {
"$t": 1
},
"openSearch$itemsPerPage": {
"$t": 5
},
"entry": [
{
"id": {
"$t": "http://gdata.youtube.com/feeds/api/videos/JCnjKb9mDlI"
},
"published": {
"$t": "2012-03-16T15:59:40.000Z"
},
"updated": {
"$t": "2012-06-04T17:47:14.000Z"
},
"title": {
"$t": "Prototype Kaiser Micro Jig/Mini Madai Rod - Miniwee 66",
"type": "text"
},
"content": {
"$t": "Location - Indonesia Boat was anchored in 30ish metres of water. Tackles: Rod - Kaiser Miniwee 66 (Prototype) Reel - Daiwa Exist 2506 Line - 4lbs Jig - 30g",
"type": "text"
},
"author": [
{
"name": {
"$t": "karaoke"
},
"uri": {
"$t": "http://gdata.youtube.com/feeds/api/users/karaoke"
}
}
],
"gd$comments": {
"gd$feedLink": {
"rel": "http://gdata.youtube.com/schemas/2007#comments",
"href": "http://gdata.youtube.com/feeds/api/videos/JCnjKb9mDlI/comments?client=ytapi-samsung-tv",
"countHint": 1
}
},
"media$group": {
"media$category": [
{
"$t": "Sports",
"label": "Sport",
"scheme": "http://gdata.youtube.com/schemas/2007/categories.cat"
}
],
"media$content": [
{
"url": "http://www.youtube.com/v/JCnjKb9mDlI?version=3&f=user_uploads&c=ytapi-samsung-tv&app=youtube_gdata",
"type": "application/x-shockwave-flash",
"medium": "video",
"isDefault": "true",
"expression": "full",
"duration": 570,
"yt$format": 5
},
],
"media$description": {
"$t": "Location - Indonesia Boat was anchored in 30ish metres of water. Tackles: Rod - Kaiser Miniwee 66 (Prototype) Reel - Daiwa Exist 2506 Line - 4lbs Jig - 30g",
"type": "plain"
},
"media$keywords": {
"$t": "kaiser, pro, shop, fishing, Fishing Rod (Sports Equipment), jigging, micro, jig, miniwee, singapore, malaysia, indonesia"
},
"media$player": [
{
"url": "http://www.youtube.com/watch?v=JCnjKb9mDlI&feature=youtube_gdata_player"
}
],
"media$thumbnail": [
{
"url": "http://i.ytimg.com/vi/JCnjKb9mDlI/0.jpg",
"height": 360,
"width": 480,
"time": "00:04:45"
},
{
"url": "http://i.ytimg.com/vi/JCnjKb9mDlI/1.jpg",
"height": 90,
"width": 120,
"time": "00:02:22.500"
},
{
"url": "http://i.ytimg.com/vi/JCnjKb9mDlI/2.jpg",
"height": 90,
"width": 120,
"time": "00:04:45"
},
{
"url": "http://i.ytimg.com/vi/JCnjKb9mDlI/3.jpg",
"height": 90,
"width": 120,
"time": "00:07:07.500"
}
],
"media$title": {
"$t": "Prototype Kaiser Micro Jig/Mini Madai Rod - Miniwee 66",
"type": "plain"
},
"yt$duration": {
"seconds": "570"
}
},
"gd$rating": {
"average": 5,
"max": 5,
"min": 1,
"numRaters": 3,
"rel": "http://schemas.google.com/g/2005#overall"
},
"yt$statistics": {
"favoriteCount": "0",
"viewCount": "1056"
}
},
{ ...
},
{ ...
},
{ ...
}
]
}
}
the important entrys are "title","url"
and this is the association:
Code: Select all
item = {
id: entries[i].id.$t,
author: entries[i]['author'][0].name.$t,
authorUrl: entries[i]['author'][0].uri.$t,
avatar: null,
title: entries[i]['media$group']['media$title'].$t,
url: entries[i]['media$group']['media$content'][0].url,
thumbnail: entries[i]['media$group']['media$thumbnail'][0],
preview: entries[i]['media$group']['media$thumbnail'][3],
description: entries[i]['media$group']['media$description'].$t,
keywords: ( '$t' in entries[i]['media$group']['media$keywords'] ) ? entries[i]['media$group']['media$keywords'].$t : '',
categories: entries[i]['media$group']['media$category'][0].$t,
duration: entries[i]['media$group']['yt$duration'],
published: entries[i].published.$t,
updated: entries[i].updated.$t,
statistics: statistics,
rating: ratings
};
you can test your JSON file here:
http://jsonlint.com/
But i did not test it, so good luck and let us know if it works.