Is MediaProtocolCommand.Listener onCompleted called when it fails to load a video? - chromecast

I am on purpose sending a video with a format that is not supported to my receiver app. I see the following message on the chromcast console:
[ 8.188s] [cast.receiver.ChannelOverWebSocket] Sending message:
["ramp",{"cmd_id":1,"type":"RESPONSE","status":{"event_sequence":10,"error":{"domain":"ramp","code":-2}}}]
from ws://localhost:8008/session?20
How do I receive that on my android app? I know onComplete for the MediaProtocolCommand.Listener is called when the video plays fine. The description makes it sound like it would also be called when it doesn't play or am I reading that wrong?
I've also tried looking into the MediaProtocolCommand returned by mMessageStream.loadMedia on a separate thread in an infinite loop and it never gets its hasError set to true. So what am I missing?
Thanks.

It appears that the Cast Android SDK isn't parsing these error messages correctly. In the sample Android client, the following exception is thrown with an invalid video URL:
MediaProtocolMessageStream(9088): error parsing message:
{"type":"RESPONSE", "cmd_id":1,"status":{"error":{"domain":"ramp","code":-2},
"event_sequence":377}} org.json.JSONException: No value for state
This looks like a bug and should be reported to Google.

Related

Flutter not showing all Pusher events sent from debug console, and showing none sent from Laravel

I am trying to show Pusher notifications in Flutter. I've set everything up and tested it with Debug console. I've noticed that, although the console itself says that, as data, you can input
{ ... } or a string
I don't get anything if it's not a json format.
Examples that work:
{"key": "value"},
{"key": 123}
Examples that do not work (Pusher says that events are sent successfully):
Test
"Test"
Why is it that some of these work and other do not?
The goal is to have Laravel send data to Pusher and get it in Flutter, but I get nothing from Pusher since the format is probably wrong, especially because Laravel's broadcastWith function requires that you return an array. I've tried returning my object in an array, as well a json encoded object in an array, but nothing gets received in Flutter.
Has anyone dealt with this, and could I get it to work?
This seems like it could be a limitation of the flutter library in use. Certainly, if the Pusher debug console it showing that the events are being sent to the channel then it indicates an issue with the binding/consumption of events on the client side.
You may need to reach out to the flutter library maintainer for assistance.

Google cast receiver throwing "Uncaught NotSupportedError: Failed to execute 'addSourceBuffer' on 'MediaSource'

We have successfully launched with chromecast support on our app and it was perfectly working fine, from the past few days it suddenly stopped working(the receiver was alway sending the buffering status to sender and it was continuously buffering), i have used the chrome debugging and able to find this exception in console
"Uncaught NotSupportedError: Failed to execute 'addSourceBuffer' on 'MediaSource': The type provided ('video/mp2t; codecs="mp4a.40.2,avc1.77.31"') is unsupported." in the media_player.js file (on the 80th line - according to chrome debugger).
not able to understand why suddenly this error is thrown, all our customers started complaining that chromecast support is not working.
can you please guide me through the problem.
Note: I have used the custom receiver sample from google cast github and modified the styling.
we are using HLS for streaming videos:
here is the sample m3u8 file content:
#EXTM3U
#EXT-X-VERSION:1
## Created with Unified Streaming Platform(version=1.6.9)
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=323376,CODECS="mp4a.40.2,avc1.77.31",RESOLUTION=1024x576
707eb5bd-dcdf-4f84-b1a3-7cdbd0d4af89-audio=131072-video_eng=174000.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=510996,CODECS="mp4a.40.2,avc1.77.31",RESOLUTION=1024x576
707eb5bd-dcdf-4f84-b1a3-7cdbd0d4af89-audio=131072-video_eng=351000.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=722996,CODECS="mp4a.40.2,avc1.77.31",RESOLUTION=1024x576
707eb5bd-dcdf-4f84-b1a3-7cdbd0d4af89-audio=131072-video_eng=551000.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1078096,CODECS="mp4a.40.2,avc1.77.31",RESOLUTION=1024x576
707eb5bd-dcdf-4f84-b1a3-7cdbd0d4af89-audio=131072-video_eng=886000.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1415176,CODECS="mp4a.40.2,avc1.77.31",RESOLUTION=1024x576
707eb5bd-dcdf-4f84-b1a3-7cdbd0d4af89-audio=131072-video_eng=1204000.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1743776,CODECS="mp4a.40.2,avc1.77.31",RESOLUTION=1024x576
707eb5bd-dcdf-4f84-b1a3-7cdbd0d4af89-audio=131072-video_eng=1514000.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2068136,CODECS="mp4a.40.2,avc1.77.31",RESOLUTION=1024x576
707eb5bd-dcdf-4f84-b1a3-7cdbd0d4af89-audio=131072-video_eng=1820000.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2498496,CODECS="mp4a.40.2,avc1.77.31",RESOLUTION=1024x576
707eb5bd-dcdf-4f84-b1a3-7cdbd0d4af89-audio=131072-video_eng=2226000.m3u8
I did saw answer to this post:
Is avc1.66.31,mp4a.40.2 supported by the Chromecast device?
but as we have different version of avc codec - avc1.77.31 don't know, what's the best way to get it working.
Note: I have posted the same question on G+ community, will update the answer there if i find a working solution here. thanks.
Try replacing your codec with avc1.77.30
host.processManifest = function(manifest) {
return manifest.replace(/CODECS=\"avc1.77.([0-9]*)/g, 'CODECS=\"avc1.77.30');
};

Chromecast sample sender application CastHelloText-chrome ends with error when trying to get session

I have problem with launching Google-Cast application similar to sample CastHelloText-chrome. I slightly modified example code for my specific purposes. The goal for creating this application is to send and show image data directly in Chromecast device.
Particularly the difference between official sample and my code is in message format and its content, sent by sender application. Sender application took png image coded by base64 and send through message bus with custom namespace. Receiver application get this message and use this as data source for html object <img>.
Error appears when I do this steps:
Reload sender page, checking console if any device found.
Send the form by just pushing enter on input box (text is ignored).
Now a popup from Chromecast extension shows. Next there are two scenarios:
3a) I confirm casting to device by choosing one from the list, then I get this error message in console:
onError: {"code":"channel_error","description":"Error: Timeout","details":null}
3b) I just click somewhere else, I get this error:
onError: {"code":"cancel","description":"User closed popup menu","details":null}
Both of errors are caused by calling function chrome.cast.requestSession in chromehellotext.html at line 161, but what's really wrong I don't know.
When I step sender script I realize that function sessionListener is never called. I know that something go wrong when code try to call chrome.cast.requestSession, where described error raises. So I need help if I missed about right way to use Google-Cast API or If this problem has something to do with networking issues.
Receiver application is registered on Google Cast SDK Developer Console and I'm testing on registered device with some serial number. I'm using Google Chrome in version 42.0.2300.2 canary (64-bit) and Chrome version 40.0.2214.111 (current stable I suppose). For testing I also tried to turn off Windows Firewall entirely but with no luck.
Edit:
There were some syntactic errors that caused error message described above.
It seems like you are trying to use the data/control channel to send an image; please don't do that; that channel is not meant to be used for large data communications; in fact it cannot send anything which approaches or exceeds 64k. If your goal is to send images from your local machine, you would need to run a local web server on your local machine and serve images through the web server.
For and easiest tutorial you can have a look to this tutorial.
It is well explained in this tutorial.
Chromecast Sender application
There is no need to maintain session by yourself.
just add button and enjoy casting
mCastManager.addMediaRouterButton(mediaRoutebtn);
I found a source of my problem. There was something wrong in receiver code - syntactic and runtime errors, so I must admit that my code wasn't functional. Now its working in terms of launching application and getting session.
Unfortunate thing is that the error message generated by Chromecast extension didn't match the actual error - at least it was a bit confusing when I didn't know what's really happening on receiver side without ability to debug the code.

Chromecast Brain Freeze Error

I have registered and uploaded my receiver.html file (receiver app) and registered it hence I have got an app ID from Google. So when I tried to cast same app, It shows me error on TV is Chrome Cast Brain Freeze
I tried to debug through it, So I opened Chrome-Cast in debug mode and I captured the screenshot of error message .
But when I enter URL of file (given during registration of receiver app), it opens in my browser, means URL is not incorrect.
So what is the problem exactly, what is missing or am I doing something wrong??
I am strucked badly over here. cant able to proceed.
Did you see the url that it shows on the very first line of your error in the debugger?

Ported Chrome extension to Firefox not working (indexedDB error)

I'm trying to port the Twitter Notifier extension to FF.
I'm not too familiar with JavaScript so I just used extension factory to convert it to FF.
Unfortunately it is not working; I don't get any HTML5 desktop notifications.
I've looked at the code a bit and I think the problem is with twitter.js which should be found in the path 'resources\extension-data\js'.
http://pastebin.com/C0NqU4Ur
First I've changed
twitter.messagesDB = window.webkitIndexedDB.open("messagesDB");
to
twitter.messagesDB = window.mozIndexedDB.open("messagesDB");
but it still is not working.
The error console also doesn't show any error.
When I put a console.log command to the twitter.messagesDB.onsuccess function nothing is being outputted to the error console.
Also no output when I create an onerror function.
So I though to surround the functions with a try and catch clause but no error is being thrown.
So I tried to put twitter.messagesDB = twitter.messagesDB.result; out of the function and the following error shows up in the error console:
Error: uncaught exception: [Exception... "A mutation operation was attempted on a database that did not allow mutations." code: "6" nsresult: "0x80660006 (NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR)" location: "chrome-extension://gjlehiopfilnaggndcmbhphaglkbkekf/js/twitter.js Line: 28"]
What does that mean?
How can I make it work in Firefox?
Thanks in advance!
Edit: I'm using Firefox 12 on Windows
This is due to an incompatibility between the Firefox implementation of IndexedDB, which supports the latest IndedexDB protocol published December 2011, and the Chrome implementation, which supports the version previous to that.
The breaking change is how databases are created, where the older (Chrome) implementation uses the setVersion transaction whereas the newer version (FF) uses an onupgradeneeded event and callback.
To see this change, please star this issue.

Resources