Google IMA event when Ad video is completed/finished - google-ima

I am new to Google DFP video / Google IMA service. I am reading the following link:
https://developers.google.com/interactive-media-ads/docs/sdks/html5/
And I cannot find any event which would tell if the Ad video is finished playing itself.
Is there a such functionality in Google IMA?
ie.
adsLoader.addEventListener(
google.ima.AdsManagerLoadedEvent.Type[SOME EVENT TYPE HERE],
[CALLBACK FUNCTION],
false);

I believe this is the one you are looking for
adsManager.addEventListener(
google.ima.AdEvent.Type.COMPLETE,
onAdEvent);

Related

Facebook instant game login with JS SDK

I am trying to upload my game made with React to Facebook Instant games. I have facebook login implemented with Facebook JS SDK. But facebook instant game runs inside a sandboxed iframe which blocks any popups and I cannot run FB.login(). In instant games docs it says that FB.login should work and it should open a popup in 'async' mode. But it doesn't. Login popup gets blocked and I get the following error:
Blocked opening ... in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.
You are looking for the wrong documentation, which leads to Legacy Web games.
You need to refer to the Facebook Instant Game SDK to get the user information inside a FB Instant Game. Most importantly FB Instant games don't allow to use of the Facebook Graph API within the FB Instant Game. Although the Graph API offers more capabilities like getting the user gender, the Facebook Instant Game SDK only exposes a limited number of data for developers. The Facebook Login for the Web with the JavaScript SDK is an OAuth login that cannot be used inside a FB Instant Game.
FYI: Facebook Instant GAme SDK v7.0 doesn't provide all the user information about the user. It only provides the following data
Display Name
var playerName = FBInstant.player.getName()
Profile Picture
var playerImage = new Image();
playerImage.crossOrigin = 'anonymous';
playerImage.src = FBInstant.player.getPhoto();
You can only use the above information in your FB instant games.

How to get playing radio station url using sonos API

We are using Sonos API for controlling Sonos. We need to play a radio station on a speaker.we are using playbackMetadata API for getting the information about the radio station and we get a response as below
{
"container" : {
"type" : "station",
"service" : {
"id" : "254",
"name" : "TuneIn"
},
"name" : "Radio Bern1",
"id" : {
"accountId" : "sn_0",
"objectId" : "s15452",
"serviceId" : "254"
}
}
}
we need to play this radio station again after a doorbell is played in the same speaker. for that, we need the URL of the radio station to play using loadAudioClip API in Sonos document. Is there any other API that we can use?
Am I correct in understanding that you are trying to resume the existing music on a device after a doorbell sound is played?
If so, then the best way to accomplish this is to use the loadAudioClip API for the doorbell sound: https://developer.sonos.com/reference/control-api/audioclip/loadaudioclip/
A solution using the loadAudioClip API would work like this:
An audio stream is playing on a Sonos speaker (in your example, a TuneIn radio station)
A doorbell press triggers a loadAudioClip API call, which plays a doorbell sound (from a provided stream URL) on the Sonos speaker
When the audio clip is finished playing, the original stream (a TuneIn station in this example) will automatically resume playing.
In summary, you want to use loadAudioClip for the doorbell sound, and it will automatically resume any music stream that was already playing.
Please let me know if this doesn't solve your problem.
Thanks!
-Mark
There is no way to get a direct stream link to a playlist item. You have two options to solve this issue using the loadAudioClip API: https://developer.sonos.com/reference/control-api/audioclip/loadaudioclip/
Option 1 - utilize the default CHIME sound that is available as part of the loadAudioClip API. After the CHIME plays, any music that was playing before will resume. Using this default sound is documented in the link provided above.
Option 2 - if you want to play a specific, custom sound clip, you will need to provide your own streamUrl to this sound clip. An example of this is also provided in the documentation link above.
I would suggest starting with Option 1 above to get your application working with the default CHIME clip. If you have a need to use a custom sound, move on to option 2 once you have your custom audio clip available via a streamUrl.
Hope that helps!
Thanks,
Mark
I'm not sure it the cloud api also supports actual urls, but in my sonos library we are generating the TuneIn url with only the information you've provided.
x-sonosapi-stream:{container.id.objectId}?sid={contianer.id.serviceId}&flags=8224&sn=0
or with your data:
x-sonosapi-stream:s15452?sid=254&flags=8224&sn=0

"Start a Hangout on Air" button for Youtube LiveStreaming API

We've been using the as yet un-deprecated "Start a Hangout on Air" button:
https://developers.google.com/+/hangouts/button
to start hangouts on air on our site http://agileventures.org for several years now. Full source code at http://github.com/AgileVentures/WebsiteOne
In the last 24 hours, clicking those buttons now redirects to instructions to manually start a youtube live event:
https://support.google.com/youtube/answer/7083786?visit_id=1-636118907663120157-3101666316&p=live_hoa&hl=en&rd=1
This is a problem as manually started events will not create the hangout app that lets our community know an event is starting and provides us with important telemetry on events.
There is unfortunately no documentation in the youtube live streaming API about how to create a button that will create a youtube live streaming event, or load a plugin into that event:
https://developers.google.com/youtube/v3/live/docs/
We need some code similar to that provided by the hangouts api, e.g.
<script src="https://apis.google.com/js/platform.js" async defer>
</script>
<div class="g-hangout" data-render="createhangout"
data-initial_apps="[{ app_id : '123456789012', start_data : 'dQw4w9WgXcQ', 'app_type' : 'ROOM_APP' }]">
</div>
but that will work with the new youtube streaming api. Any ideas?
The YouTube live documentation talks about being able to create a broadcast, but it seems to be only for custom "streaming" broadcasts and not hangouts:
https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/insert
The new events page allows us to select the "quick" type, which creates a hangout on air (https://www.youtube.com/my_live_events?action_create_live_event=1) so we can create HOAs manually, but not programmatically? We would very much appreciate clarity from Google on this.
It seems that support for Hangout on Air Buttons, creation of HOAs via API has been dropped no?
Note that Google is specifically requesting support questions for the Youtube LiveStream API are posted to StackOverflow:
https://developers.google.com/youtube/v3/live/support
The functionality all started working again after a 3 week break. We're not sure if Google changed anything. There were no changes on our end. Buttons for starting HOA's have been stable now for the last two months or so ...

Is there any way to know if a youtube video display ads? via API?

Some youtube videos has those ads show up on video at the bottom of the screen. Is there any which I can find out which videos have these kind of ads?
You can use the listener services which have methods such as onAdStarted().
Full dev doc: https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayer.PlayerStateChangeListener

How can I post a video, via Facebook's Connect API, to my Facebook profile page?

Has anyone posted a video via the Facebook Connect API to their profile / feed page?
Ideally, the video should be queued to the first frame with the superimposed Facebook's blue right arrow "play" button. Or if a thumbnail representing the video has to also be uploaded (rather than the video being queued to the first frame) as well, this is fine.
Also, when the video, or thumbnail, on the profile page is clicked, the video plays where it is - rather than going to another page off Facebook to be played there.
The question may have not been correctly worded. The term "API" was misleading to a couple of folks - and I apologize for that.
What I was trying to do was to "share" a video by linking it in Facebook, AND to have it play in the profile feed (ie. to not leave the Facebook site while viewing the video - just like YouTube and Hulu.com do).
After digging into the JavaScript that Hulu was using to get this behavior, we noticed that a link tag was missing between our version of the <meta> and <link> tags, and Hulu's.
Facebook's web page, http://www.facebook.com/share_partners.php, was missing a tag that you should have if the content is a video, and you want it played in the profile feed.
Along with:
<link rel="video_src" href="http://www.example.com/player.swf?video_id=123456789"/> ...
You should include:
<link rel="media:video" href="http://www.example.com/player.swf?video_id=123456789"/>
That will get it to play in the feed. BUT, your domain name must be whitelisted.
To get your domain whitelisted, fill out this form: http://www.facebook.com/share_partners.php#/developers/developer_help.php
I got a reply, and approval, within a day! Kudos to the Facebook developer support staff!
Use the Video.upload as described by stevedbrown or the Stream API or if you want to go simple share the link via API or share link.
Have you read the Facebook developer wiki page on this? That explains what is possible and how, it's pretty decent.