YouTube API liveBroadcastContent field incorrect for stream - youtube-data-api

When I hit the video list endpoint on the YouTube API (https://www.googleapis.com/youtube/v3/videos), and pass a stream's id for in the "id" field, I always get back the following result for the liveBroadcastContent field:
"liveBroadcastContent": "none"
I am relying on this field to determine whether or not a video is a stream. But if this field does not return "live" for a stream which is live, I can't determine if the video is a stream. It is worth noting that the request is sent within a few minutes of the stream starting, so that may have something to do with it.
Is there a more reliable way to find out whether a YouTube video is a stream?

Related

Youtube API, can I query videos filtering out channels?

I am writing queries to the Youtube Data v3 API and I want to see a list of videos that don't include videos by a certain channel. For example, a keyword search "iPhone" but not by Apple's channel. It doesn't work if I just do "-Apple" because that is filtering out the keyword versus the channel. Is there any way to do this?
Using as the query '"iPhone" -Apple"' removes all videos containing Apple (source), so it removes more than what you want but it does the job.
By the way Apple only uploaded 202 public videos as of today, so you could just exclude their channel id (UCE_M8A5yxnLfW0KghEeajjw) from the results you got with Search: list.

When is MediaStreamSource.SampleRequested callback Method called in UWP?

I'd like to know when the SampleRequested event is fired in UWP. According to the official doc page it
Occurs when the MediaStreamSource request a MediaStreamSample for a specified stream.
but I'd like to know more in more detail when this request occurs. For instance what make this event happen? Every frame change? Every packet received from the RTSP stream?
Furthermore I'd like to know if there is a way to "control" this event, i.e. firing it programmatically since I need to take the MediaStreamSample only in a specific moment and only one time. And it looks like it happens multiple times during my rtsp streaming effecting the latency of my stream (about 4000ms lag).
Thanks.
I haven't used MediaStreamSource in UWP extensively so I provide just a general suggestion, maybe someone more experienced will provide a more useful answer.
I presume this event is called by the media player control to preload the stream and you cannot control the frequency at which it is called. What you can control however is how soon you provide the response - MediaStreamSourceSampleRequestedEventArgs event args have a Request property, which is of type MediaStreamSourceSampleRequest. You can use GetDeferral method to indicate you need to delay the delivery of the sample and return it only after a specific delay. You can indicate "loading" to the user using the ReportSampleProgress method. When you are done, you can indicate this on the deferral by calling deferral.Complete().
Finally, if you no longer want to provide any samples, just assign the Sample property to null.

YouTube videos stats using Google API YouTube Analytics in one request

Is it possible to get daily video stats for X videos at once?
YT Analytics API does stats only for a channel. Of course I can filter results by video ID (but only one!). I'm getting an error while trying to put "video=1;video=2;video=3" in filter method.
From the documentation of the reports.query endpoint of the YouTube Analytics API, assuming this is the endpoint you are referring to:
The API supports the ability to specify multiple values for the video, playlist, and channel filters. To do so, specify a separated list of the video, playlist, or channel IDs for which the API response should be filtered. For example, a filters parameter value of video==pd1FJh59zxQ,Zhawgd0REhA;country==IT restricts the result set to include data for the given videos in Italy. The parameter value can specify up to 200 IDs.
In other words: only use commas between video IDs (not semicolons), don't repeat the video keyword for each ID and use == instead of =.

What is counting on rate limit of soundcloud?

In my application I have a search list of musics and an embedded player. I need refactor some functions, but I can't understand what is the specific count event. What is counting in rate limit by SoundCloud? Search for list song is measured? Play calls?
In SoundCloud doc text we have:
"Effective July 1, all requests that result in access to a playable stream are subject to a limit of 15,000 requests per any 24-hour time window".
This refer the all JSON's calls only?
A play request is defined as any request against the SoundCloud API which would generate a URL for streaming audio content in its response.
For example, a GET to http://api.soundcloud.com/tracks/3/stream returns a URL which you can use to stream audio content. This request would count against your daily rate limit of play requests.
Hope that helps.

Obtaining duration for Youtube activities through Youtube-data api

I am using the following api call to obtain activities.
https://www.googleapis.com/youtube/v3/activities?part=contentDetails%2Csnippet&
home=true&maxResults=15&&fields=items&key=<my key>access_token=<my token>
It works fine, except that it does not display the duration in the response. I have tried adding "duration" in the fields parameter, but it doesn't work.
What is the way to obtain the duration in a single request?

Resources