Here is a glimpse of the upcoming video API: http://www.vrdmn.com/2015/01/glimpse-of-upcoming-office-365-video-api.html
Original post follows:
In my previous post, we saw how you can get a list of all the video channels in your Office 365 portal with the REST API. In this post, we will see how to get a list of all the videos in a particular Office 365 Video Channel with the SharePoint REST API.
Each video channel is underpinned by a separate site collection in SharePoint Online. When you upload a video to a channel, it gets uploaded in the "Videos" library of the root web of that site collection. A copy of the video is sent to Azure Media Services which then transcodes it so that it can be played from a number of devices. Since the video is stored in SharePoint Online, the size of the video counts against your Tenant storage.
Since each video channel is a site collection, you can use the REST API to get all sorts of information about the channel including the list of videos.
So this is a channel called "Development" on my Office 365 Video Portal. You can see that there are 3 videos uploaded to this channel:
In order to get the list of videos in a video channel, we need to make a REST call to the SharePoint Search REST API:
_api/search/query?querytext='SiteTitle:"Development" AND ContentTypeId:0x010100F3754F12A9B6490D9622A01FE9D8F01200F9B0E79C5EBC0545B80F5F1B3985E159'&selectproperties='Path,Title,SiteTitle'
The ContentTypeId is the id of the new "Cloud Video" content type and the SiteTitle will be the name of the Channel.
Here is the complete code. I have used JavaScript and the jQuery.ajax function to make calls to the SharePoint REST API. But you can use a variety of other options like the JSOM, CSOM or even the Office 365 APIs. Since all the channels are by default open to users in the tenant, there should not be any major challenges to authentication around this. I haven't tested the code for these APIs myself.
And the logs in my Dev tools console:
Thanks for reading!
2 comments:
Hi Vardhaman,
This is nice. But will we get all the properties which we get from Videoservice _api ? like yammer play back url and all
Regards,
Syed
Hi Mudasar,
The VideoService API is definitely the preferred way of accessing videos. This article was written before the API was released. That's why I have updated it with a link to my other article about the VideoService API.
Post a Comment