iOS - Chromecast - app not loading media - ios

I have a problem with launching media from iOS app. When I call mediaControlChannel loadMedia:, nothing happens on receiver app - no loading bar appears, but neither of GCKMediaControlChannelDelegate methods are being called. After waiting some time, when I disconnect from the device, only then delegate receives didFailToLoadMediaWithError with error 92: unexpected disconnect.
I thought that the media or some of the parameters are incorrect, so I used them in Google's example iOS app, but it all works fine there.
Before trying to load media I check if I'm connected to device and to the application, mediaControlChannel is added to deviceManager. I also call requestStatus on mediaControlChannel to make sure I don't get kGCKInvalidRequestID and everything's fine. Only then I try to load media, but as I said - it just doesn't work, no error, no feedback from receiver app. I'm out of ideas.

Related

WCSession connection fails at specific moment

I have a weird behavior happening to me while using the watch connectivity.
I start the session from the AppDelegate's didFinishLaunchingWithOptions.
The user's goes through the login process, and when the user get's to the home screen if the user open's the Watch it seems that something goes wrong with the session.
At this point I get this log:
[WC] -[WCSession onqueue_handleDictionaryMessageRequest:withPairingID:]_block_invoke delegate MCEWatchSessionDelegate does not implement delegate method
[WC] -[WCSession _onqueue_sendResponseError:identifier:dictionaryMessage:] identifier: [identifier] with WCErrorCodeDeliveryFailed
And at this moment if I print the error on the watch if get:
Error Domain=WCErrorDomain Code=7014 "Payload could not be delivered." UserInfo={NSLocalizedDescription=Payload could not be delivered.}
and there is nothing in the login process using the session or anything related to the WatchConnectivity.
If the user opens the watch app on the login screen, everything works as expected.
If I close and open the app again (session get's activated again) it runs normally and the issue is gone.
If I activate the session again from the iPhone app after the watch has tried and failed to send the message, it goes back to normal.
If I dispatch a queue with a delay, activating the session again on the Iphone app to after the home screen is shown, it also work's normally.
The problem seems to happen only on the first time the user enters the application after the installation, manually log's in and get's to the home screen.

Monaca Push Debug App

I am working on an app using Monaca where I need to be able to push notifications to users of the app. I tried getting the monaca push back-end working, and that wouldn't work, the app didn't register. I then moved to using the standard cordova plugin, so I can push directly from my servers, without using monaca's back-end. when I call the init function, normally a register event will fire, this works fine when I build the app. However I very much want to get the custom debugger working, I am able to build the custom debugger, and I see the plugin properly installed. Also the init function gets called, as soon as it is called I get the standard IOS security alert to grant the app permission, however the register event is not fired, therefore I am unable to get the device ID to push to the custom debugger app. Has anyone been able to use push notifications with the custom debugger application?
Best,
Peter
(https://github.com/phonegap/phonegap-plugin-push)
P.S, i calls to set the badge count setApplicationIconBadgeNumber works fine in the debugger. I think this is something simple, maybe with the certs? I dont get any errors fired, no notifications no clues using the standard debugger, how can I hunt down what the issue is?
I can get it work using ngCordova, which is AngularJS integration.
http://ngcordova.com/docs/plugins/pushNotifications/
Then, inject it like
var app = ons.bootstrap('myApp', ['onsen', 'ngCordova']);
Get back to me if you need further clarification.

How can I send a message to a custom Google Cast Receiver from Chrome for iOS?

I'm using the CastHelloText-chrome example and am able to get it all working just fine from the Chrome browser on my desktop, however, when I try to use Chrome on my iOS device, I receive the following error when trying to create a session:
{ "code": "channel_error", "description": "The operation couldn't be completed. (com.google.chrome.ios.cast error 2.)" }
This error happens when executing the following:
chrome.cast.requestSession(function(e) {
session = e;
session.sendMessage(namespace, message, onSuccess.bind(this, "Message sent: " + message), onError);
}, onError);
Specifically, this seems to happen on the requestSession function call (the nested callback never actually executes).
Everything up until this point seems to work. In fact, on my iOS device, I even receive the popup asking where to cast to (Chromecast) and once I select it, my Chromecast does indeed display my custom receiver. However, I still receive that error message and never get a session object, so I can't send messages to the receiver.
Like I said, this seems to work fine on my desktop Chrome browser, but does not work on my iOS Chrome browser. Does this sample not work on iOS devices? Is there a way to make it work?
Chrome on desktop and Chrome on mobile are not the same. You need to use the iOS API. Use the sample app for CastHelloText-ios as a reference.

com.google.GCKError Code=2 when connecting to ChromeCast device

I'm working on an iOS app where I now want to integrate ChromeCast support. I use the HelloGoogleVideoCast example to test my hardware setup and get inspiration for my app.
I have now stumbled on a problem that is present both in my app and in HelloGoogleVideoCast. When I connect to a device (connectToDevice method in HelloGoogleVideoCast) I get error "The operation couldn’t be completed. (com.google.GCKError error 2.)". I have power-cycled the device with no change in behavior. I never get to the callback deviceManagerDidConnect, instead deviceManager:didFailToConnectWithError is called with this error. Still, I can connect with the iOS YouTube app.
I can't find anything with substance if I google it and I can't find any good ChromeCast developer forums.
Is there anybody who has an inroad to how to solve this?
I m not sure it will help but u can try:
Download the Chromecast app from app store:
chromecast link
After u see your chromecast -> select your chromecast -> General -> make sure both check box are selected (I know the text is nothing to do with your problem).
Try now.
If the error still occur, try to reboot your chromecast.
If your error still occur, try to reset your chromecast, and then check the boxes again (don't forget!).
Make sure that you initialize the Receiver Manager in your receiver app as soon as possible. Don't wait for the window.onload. If the receiver takes too long to load and initialize the receiver manager, the connection is automatically torn down.
I had the same problem as you did and making the following changes on receiver worked for me:
I've put the script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js" inside head tag and before title tag;
I've put my script file which managed all cast functions after
body tag (actually I've put all script declarations, except for cast_receiver, after body tag, including jQuery);
I hope it can help you yet :)

how to get audio session initialization error status since AudioSessionInitialize was deprecated?

On start app i called AudioSessionInitialize and check result value.
If it was kAudioSessionInitializationError then i informed user that application can not work properly cause audio does not work.
But since iOS 7 this function was deprecated.
It was similar question before: A fix for AudioSessionInitialize Deprecated? but... it has no any mention about how to get initialization error status.
And of course, i know how to initialize audio session without this function: Just calling [AVAudioSession sharedInstance] cause hidden call of AudioSessionInitialize. But it returns non zero value anyway. So new interface does not allow to get initialization error status.
upd: I'm not sure it's important but i receive message to stdout (which i redirected to log file) while call with error happens:
ERROR: [7971] 146: Unable to talk to server: error 0x10000003
(268435459)
explaination why i need this:
It happens very rarely (less then 0,1% of case) but it happens for any firmware. Last case registered for iOS 7.0.3 - so it's actual return value still (btw, first case registered for first firmware my app supported: iOS 2.2). It's important feature (cause i develop alarm clock) - it allows to know user about issues in the evening and not in the morning (cause in the morning this issue will cause oversleep).

Resources