Update Chromecast MediaMetadata - android

I'm playing a live HLS stream in a Chromecast app, and I'm wanting to update the MediaMetadata when programmes start/finish. However I can't find a method to do this. I can load the stream again with fresh MediaInfo, but I can't just update the existing metadata. Is there any way to do this?
At present I'm casting from an Android app.
Is there a way to send fresh MediaMetadata to the receiver, or can I pass a custom data message with the information, and update the metadata within the sender using javascript?

see 'CCL' in general for the interfaces to manipulate things like metaData on events like onRemoteStatusChange()...
Looking at that, IMO if you want to alter the message type below to "METADATA_CHANGE" OR whatever it would be for a change in the mediaInfo, then just send the message to the receiver and you should get the broadcast you want... onMediaDataChanged().
sample msg from receiver to CastMgr...
{"requestId":0,"status":{"applications":[{"appId":"33E59692","displayName":"test-receiver-app","namespaces":[{"name":"urn:x-cast:com.google.cast.player.message"},{"name":"urn:x-cast:com.google.cast.media"}],"sessionId":"0869F8A7-25CE-E55F-F571-346EBABB81FB","statusText":"Ready To Cast","transportId":"web-3"}],"isActiveInput":true,"volume":{"level":1.0,"muted":false}},"type":"RECEIVER_STATUS"}
onRemoteMediaPlayerStatusUpdated()
When the receiver goes from PLAY to IDLE at the end of a video , the status change event is called on all 'listeners' ie all implementations of IVideoCastConsumer that have registered as listeners for 'status-changed'.
In the Base CCL class of BaseCastManager, you can watch for this specific status change and then broadcast your onRemoteMediaPlayerMetadataUpdated() event and all observers will get appropriate callback on that.... OR listen on event and just send the correct type of message to the receiver.
If its not exactly intended to observe mediaMetaDataChanges IMO , looking it over may help you tweek the existing API with and #Override in order to get your desire result.

Related

Broadcasting Android application using Opentok SDK

Im working on an android application where multiple user subscribe to my stream published from android device. What i want to pull off is, when i click the video of a certain subscriber, all the subscriber(user) will then subscribe to his/her stream rather than mine.
if there is any article or code to suggest me, please do so.
I don't have a sample to point to but I can tell you how I would solve this.
You will need to communicate to everyone in the Session which stream to subscribe to. You can use the signal API in opentok to do this by passing a streamId along. Then when each participant receives that signal they can lookup the corresponding stream and subscribe to it. You will need to make sure that every time a new person joins you also send them a signal saying which stream to subscribe to. You can do this by listening for the connectionCreated event.
If only one participant is allowed to tell everyone who to subscribe to then you might want to have a look at the connection data property of tokens. Then you can add eg. 'admin' as the connection data and then when you receive the signals make sure that they are coming from someone that has 'admin' as their connection data.

Google play services simple chat implementation?

I am looking to create an extremely simple chat feature for my app.
I just want to be able to send a message to the opponent in my Turn-Based Multiplayer match.
I don't want to use libraries like Scringo and what have you. Is there any way to implement this?
I've tried to use Games.RealtimeMultiplayer.sendReliableMessage() but my players aren't in a room so it does not work.
In looking through the API, it appears that the only way to send out data is to call takeTurn
To take a turn, use this method:
Method Description
takeTurn()
Your game should only invoke this method when it is the user's turn in an active turn-based match. After invoking this method, the user sees this match under the Their Turn list in the match list UI.
If a participant ID is specified in the method call, that participant becomes the current player and can play a turn. The first time this happens to an invited player, the player receives an invitation notification. Subsequently, the player receives a turn notification.
If no pending participant ID is specified, the match state changes to MATCH_STATUS_AUTO_MATCHING. Your game can only leave the participant ID unspecified if there are player slots that are still vacant for auto-matching.
Your game can call takeTurn() with the current player as the pending participant. In this case, Play Games services uploads the the game data but no notification is sent.
There are no other calls that change the data that is held in the servers and passed to the other player(s).
Now, having said that, it IS possible to send out a chat for the player that currently owns the Turn. It would appear that there are two ways to do that, either include the Chat and set the Pending Participant to the Next Participant... or update only the Chat portion, and then call takeTurn with the Pending Participant set to the currently active Participant. Looking at the documentation, this would then update the Data held on Google's servers, BUT, would not necessarily send out any notification that it had updated, as it appears that Notifications are only sent out if it is actually to notify a Player that it is their turn. (if you envision your app as being open while the Player waited for others to complete, then it could poll for the data using getData(), as there is no requirement that I can see for it to be a Player's turn to request the Data().
This would allow a player to Chat, but not Real Time like you mention... as the API is strictly turn based.

How can I play sound when device receive incoming call in android?

I want to receive incoming call automatically that was I done already now I want to play my own created sound to my caller rather than android will use its default mike..
Can is it possible to play our own sound after receiving incoming call?
I refereed this. Can anyone tell me is it possible now?
I searched lot related to this topic but still I am not able to find something useful.
If anyone know about this then please help me..
Thanks in advance.
I found this may be helpful for you
quote from: How to automatically answer call and play prerecorded sound out to the caller and DTMF on Android
"No, sorry, Android has no access to the in-call audio stream. Closest thing is if the device is in speakerphone mode, you can blend your audio into what the speaker plays, which may get picked up by the microphone."
As described here (http://www.krvarma.com/2010/08/detecting-incoming-and-outgoing-calls-in-android/), you should be able to detect this:
To detect the incoming call, we register a BroadcastReceiver for the
action android.intent.action.PHONE_STATE. This will be broadcasted
when there is a change in phone state. The receiving intent will have
an extra string variable TelephonyManager.EXTRA_STATE which describes
the phone state. If this state is TelephonyManager.EXTRA_STATE_RINGING
then there will be another extra string variable
TelephonyManager.EXTRA_INCOMING_NUMBER. This variable contains the
incoming phone number. Note that this variable will not be present
when the state is not TelephonyManager.EXTRA_STATE_RINGING.

Listen for certain incoming SMSes

Is it possible to have an app listen for all incoming SMSes and take some action on certain ones?
I read through as many of the similar questions as I could but ended up more confused.
Basically, what I want to do is this:
Every time a new SMS is received, the app checks either the sender or the text, and if a certain string is found shows a message on the screen (Toast, for example).
The app doesn't have a GUI, and if possible I would like to to be running all the time in the background.
If possible, I would also like any SMSes that are shown this way to be deleted before they reach the inbox (or automatically deleted just after).
So, is this at all doable?
Yes this is very possible. With the implementation of a BroadcastListener you could easily be able to determine when an SMS is received by registering the listener to listen to that broadcast. Then in that broadcast receiver code you implement a check for the text of the message. Then do a string compare with what you are looking for and then execute a function.
However; deleting the message from the inbox.. may take a bit of research, i'm not absolutely sure if its possible to delete SMSes programatically, but it wouldn't surprise me if it is included in the API, although, I've never seen it.

Are there any broadcast receivers to be able to tell when messages have been read?

I've written a program which uses Broadcast receivers to identify when certain events happen - e.g. new SMS/MMS message, missed call and new gmails.
When the broadcast receivers are triggered I'm setting variables to store the new states that have happened. What I'm looking for is a way to be able to change the setting upon the user seeing these messages - i.e. viewing the SMS, reading the e-mail or viewing the call log - or once they've clicked on the notification. Are there any broadcast receivers to be able to do this, or is there another way?
I ideally want to avoid having to poll for these changes and want to reflect the changes when they happen. Even if polling I'm not sure what I'd look for to see when a user had viewed the call log - for the others I can see how I could use the content provider to handle them.
if i remember well , registerContentObserver(Uri.parse("content://mms-sms"),true,m_MMSObserver)
return something every time something is modified in the database (either adding line or modifying a line) , it should do the trick

Categories

Resources