2011-03-18 35 views
0

問題:客戶端有很多視頻。他將它們上傳到YouTube。我爲他建立了一個簡單的CMS,他更新了網站上的內容。我想簡化在cms內鏈接視頻的過程。Youtube視頻鏈接在我自己的管理員中

目前他已經

  1. 將視頻上傳到YouTube
  2. 「內嵌」 YouTube的代碼在CMS。

有沒有更簡單?解決方案更好任何建議都會非常有幫助。 在此先感謝。 沙恩

+2

您可以使用http://code.google.com/intl/et-EE/apis/youtube/overview.html – Margus 2011-03-18 20:23:52

回答

2

在客戶端建立YouTube頻道,並創建信道內的播放列表(一個或多個)。然後,客戶端可以告訴您哪些播放列表要包含在網站上,並且您可以通過YouTube API訪問特定播放列表中的所有視頻。

這樣你設置它(一次),並忘記它。客戶可以在YouTube內維護他們認爲合適的播放列表,並知道這些播放列表中的視頻將自動包含在網站上。

下面是一些示例代碼段:

// Init service. 
YouTubeService service = new YouTubeService("MyApplicationName", "MyDeveloperApiKey"); 

// Get playlists for youtube user (your client). 
PlaylistsFeed playlists = service.GetPlaylists(new YouTubeQuery("http://gdata.youtube.com/feeds/api/users/[CLIENT_USER]/playlists")); 

// Get playlist feed. 
PlaylistFeed feed = service.GetPlaylist(new YouTubeQuery("http://gdata.youtube.com/feeds/api/playlists/" + playlistID))); 

// Get list of video IDs for playlist. 
(from atomEntry in feed.Entries select (atomEntry as PlaylistEntry).VideoId).ToList());