KirovBvulgaru / google-cast-sdk

Automatically exported from code.google.com/p/google-cast-sdk
0 stars 0 forks source link

Receiver error when using GCKMediaControlChannel's sendTextMessage (iOS SDK) #161

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Start a media session
2. Use the GCKMediaControlChannel's's sendTextMessage method

What is the expected output? What do you see instead?

The receiver spits out an error "[cast.receiver.mediaManager] Ignoring request, 
requestId is not an integer: undefined", which it shouldn't IMHO

Note that all other commands sent to the same media session work flawlessly 
(load, play, pause etc... )

My (wild) guess is that the GCKMediaControlChannel inherits directly its 
sendTextMessage method from the GCKCastChannel, failing to implement some of 
the messaging aspects specific to the media channel (in particular failing to 
wrap the message in a media-style envelope with the requestId and 
mediaSessionID attributes)

Feel free to contact me with questions if needed

Original issue reported on code.google.com by hhar...@gmail.com on 22 Feb 2014 at 1:53

GoogleCodeExporter commented 8 years ago
Please state clearly what the issue is, I am not clear on what you are saying 
here.

Original comment by anad...@google.com on 22 Feb 2014 at 6:03

GoogleCodeExporter commented 8 years ago
Rephrasing:

Messages sent by the sender iOS app via the sendTextMessage method of the 
GCKMediaControlChannel always die in the receiver with the error below

"[cast.receiver.mediaManager] Ignoring request, requestId is not an integer: 
undefined"

..as a hack, one could add the requestId manually to the message, however the 
message will again die in the receiver which complains that the message is 
missing a "sessionMediaId" attribute.

This may be a document bug 
(https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_cast_chan
nel#a536d42cdfb9d56d9ed10c3f75c493985 does not mention anything about the need 
to add special attributes to the message), however it makes more sense for the 
SDK to wrap application-produce messages since that type of metadata is owned & 
managed by the SDK - so this is likely a problem with the SDK itself.

=====Sample sender code reproducing the issue====== 

NSDictionary *messageDict = @{
                            @"message": @"blah",
                            @"num":[NSNumber numberWithInt:2]
                            };
  NSError *error;
  NSData *msgData = [NSJSONSerialization dataWithJSONObject:messageDict
                                                      options:0
                                                        error:&error];
  NSString *message = @"" ;
  if (!msgData) {
    DDLogError(@"ERROR serializing message: %@", error);
    return NO ;
  } else {
    message = [[NSString alloc] initWithData:msgData encoding:NSUTF8StringEncoding];
    [self sendTextMessage:message] ;
  } 

Original comment by hhar...@gmail.com on 22 Feb 2014 at 8:29

GoogleCodeExporter commented 8 years ago
If you want to send a custom message, then you need to use a custom namespace. 
Don't use the media channel to send custom messages.

Original comment by lnicho...@google.com on 22 Feb 2014 at 8:37

GoogleCodeExporter commented 8 years ago

Original comment by anad...@google.com on 23 Feb 2014 at 1:23