How to get the preview monitor work through Livestream API - youtube-api

I'm using Livestream API to transition a stream from "ready" to "testing". And after successful transition to "testing",
the response returned with contentDetails object with monitorStream.embedHtml.
But the embedded html with the livemonitor, is displaying "sign in to view this video". My app is already authorized with OAuth 2.0.
Isn't it possible to view the Preview through the embedded html?

It is possible, according to this document - Stage 3: Test,
you embed a player that shows the monitor stream for your broadcast so that you can test the viewing experience.
Follow the steps:
Embed a monitor stream player
Retrieve your broadcast using the liveBroadcasts.list method, and extract the value of the contentDetails.streamDetails.monitorStreamEmbedHtml property. That value contains the HTML that you need to embed a YouTube player that shows your monitor stream.
Start your video
Start transmitting video on your video stream.
Following this should help you preview your livestream for testing. You may also check how you authorize your request since a sign in is being display to view the video.
NOTE:
The monitor stream is a private stream that lets you preview the broadcast video as it would appear to YouTube viewers. Note that you can only test your video broadcast if its monitor stream is enabled.
Hope this helps.

Related

Cordova ios watch live video streaming ApiRTC

I am using cordova ios app for live streaming. I am able to stream video from iphone but when i try to join stream it never calls remoteStreamAddedHandler function to display streaming video.
I am using cordova-plugin-iosrtc plugin. It also shows status that "someone has joined room" but not calling that remoteStreamAddedHandler where i can append video tag from. It is working fine in andriod phone.
Thanks
remoteStreamAddedHandler event is fired when a remote user has already joined the room and published his stream.
On apiRTC tutorial : 11-VIDEO CALL STREAMING, user only subscribe to available streams (there is no video publish)
You need to have an user connected with tutorial 10-GROUP CALL, this user will publish his stream and subscribe to remote streams.
The tutorial 12-GROUP CALL - ADVANCED shows you an advanced sample where user can choose to publish/subscribe streams.

Any way to Keep LiveStream active on Youtube Livestream?

I'd like to livestreaming my lectures to Youtube with youtube-livestreaming-api.
I create new live events when the lectures start and I transit my LiveEvent to completion when the lectures end.
The problem is break-time. when break-time short, I don't need to change or insert LiveStream because the Live Stream is still active even though LiveEvents stop. The problem is when the break-time long, the Live Stream turns to inactive. so I can't transition to testing and live. Is there any way to keep LiveStream active?
Any Suggestion? or Any Idea?
You may use the LiveBroadcasts:transition and should confirm that the value of the status.streamStatus property for the stream bound to your broadcast is active
A liveStream resource contains information about the video stream that you are transmitting to YouTube. The stream provides the content that will be broadcast to YouTube users.
HTTP request
POST https://www.googleapis.com/youtube/v3/liveBroadcasts/transition
Note: This request requires authorization with at least one of the following scopes.
The parameter broadcastStatus identifiees the state of which the broadcast is changing. Note that to transition a broadcast to either the testing or live state. live is visible to its audience. YouTube transmits video to the broadcast's monitor stream and its broadcast stream.

How can I link my private videos on YouTube to be played on my website?

How can I link my private videos on YouTube to be played on my website. The point is to bring more viewers to my site by making videos available on my site, yet private on YouTube.
You should set your videos to "unlisted" instead of "private". That
way the video does not show up on your channel or on any search
results but anyone with a link to the video can see it and you can
embed the video on any site.
I didn't try this workaround yet but theoretically it should work, you need to use YouTube API V 3 and follow the below steps:
Set the video's privacy status to unlisted through API.
Embed the video via API in a hidden div.
Use onPlayerStateChange event to check if the video player is currently playing the video, use the API to pause the video at the first second.
If the state changed to "playing" then send an AJAX request to a server side script to revert the the video's privacy status to be private, once you get a confirmation message display the video and use the API to play it.
This should keep the video private even if the user copy & paste the URL in another tab, s/he should get a message that the video is private.
References:
https://developers.google.com/youtube/iframe_api_reference?hl=en
PHP - How to change privacy status of a youtube video through Youtube API v3?

Youtube API Java client library - How check if a video entry is available for mobile?

I have a content management server application written in Java. A background process goes through a list of video ids and fetches the details for those video ids using Youtube API.
I would like to check if a particular video entry is available for mobile or not.
I checked syndicate allowed like
String videoEntryUrl = "http://gdata.youtube.com/feeds/api/videos/"+videoID;
VideoEntry videoEntry = service.getEntry(new URL(videoEntryUrl), VideoEntry.class);
if(!videoEntry.getXmlBlob().getBlob().contains("yt:accessControl permission='denied' action='syndicate'")){
System.out.println("The video is syndicatable");
}
Checking for syndicate still not solved the problem and the server still lets in videos that cannot play on Android phone.
What is the right way to filter only the videos that can be played on mobile?
There's no single check to see whether a video is playable "on mobile".
There are a variety of different reasons why a particular video might not be playable on a particular platform, and unfortunately the only way to be absolutely sure whether a particular video will play in a particular player is to attempt to play it.
That being said, this blog post goes into more details about the types of common playback restrictions that crop up: http://apiblog.youtube.com/2011/12/understanding-playback-restrictions.html

Using Google's youtube API is there a way to determine if a video has been removed or no longer available?

I have been using the Google data API to search video from Youtube and play it back in a chromeless player as part of a Flash (AS2) swf I have developed. here's my workflow -
Search Youtube with PHP page that includes Zend_Gdata_YouTube class
Retrieve and display videos in a Flash swf which play if user clicks.
Store video ids in database for playback later - like a playlist
Then when the playlist is played (in another swf) the database is read to get the video ids to play and Flash loads the videos as needed.
Here's the problem. While the search works fine and returns thumbnail images of all the videos some of them do not play on click. Using Firebug in firefox I see that the attempted load of the video returns a 204 No content, but there is no info in the response tab. SO ...
a) how would I catch these videos so they dont get returned in the search results?
b) What would happen if a video that did play ok initially later got removed from Youtube, how could I catch this (preferably with flash) and remove it from the playlist (database).
any thoughts?
cheers

Resources