How can I stop a radio streaming with sonos cloud api? - sonos

I developing a new application to control Sonos speakers with New Sonos Cloud API and in the documentation, there is nothing to stop the radio stations when it's playing. the API return can pause == false but there is a stop possible? If yes how can I do it?

Have you tried just calling pause? https://developer.sonos.com/reference/control-api/playback/pause

Related

Update a youtube video via YouTube data API, add end screen and cards

I can't find how to Update a youtube video via YouTube data API, for to add end screen and cards.
There is nothing in the google API documentation. Is it possible? If yes how?
I tried of fin how to Update a youtube video via YouTube data API, for to add end screen and cards.
I expect a response : Is it possible? If yes how?

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

Google IMA event when Ad video is completed/finished

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);

Mac API to get current media playing

On the mac you can use their native 'f-keys' to do things like change volume, brightness, and even pause or play music or video.
I was wondering if there was someway to access to 'now playing' media (music or video) through an API or something?
I know it's possible to get currently playing tracks from iTunes using things like ITLibMediaItem or even from other apps by using Applescript to ask the application what it's header is. But how would you figure out which application is the 'currently playing' one and then get the play pause functionality?
Does Apple have an API for this?

Play and pause media on windows mobile device from a separate app

I need to make an app for windows mobile devices which will play and pause media despite of the current player in use. Are there any system calls I can use or any API that I can refer?
Thank you in advance.
Use background audio player to achive your functionality, here is step by step implementation of your query
click here: