wavefree / google-cast-sdk

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

Chromecast API can't be injected into Chrome Packed app/Legacy Packed App #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add data-cast-api-enabled="true" to <html> tag of your app
2. Add your extension id to whitelist of Cast SDK additional domains
3. Launch App. 
4. cast api is not loaded.

What is the expected output? What do you see instead?
Cast Api should load into packed apps too. But right now it doesn't because of 
protocol restrictions in background_script.js.

What version of the product are you using? On what operating system?
Windows 7
Google Chrome 28.0.1500.95
Google Cast 2.2013.10802.11508

Please provide any additional information below.
If we add "chrome-extension" protocol to whitelist we encounter a problem with 
injecting a script into app.
line 13661:  chrome.tabs.executeScript(a.id, {file:"api_content_script.js"}, m)

Error:
tabs.executeScript: Cannot access a chrome-extension:// URL of different 
extension
    at d.AC (chrome-extension://boadgeojelhgndaghljhdicfkmllpafd/background_script.js:13661:15)
    at null.<anonymous> (chrome-extension://boadgeojelhgndaghljhdicfkmllpafd/background_script.js:13655:19)
    at Array.some (native)
    at Ra (chrome-extension://boadgeojelhgndaghljhdicfkmllpafd/background_script.js:285:17)
    at d.XF (chrome-extension://boadgeojelhgndaghljhdicfkmllpafd/background_script.js:13652:85)
    at d.wC (chrome-extension://boadgeojelhgndaghljhdicfkmllpafd/background_script.js:13625:72) 

Original issue reported on code.google.com by gapipro@gmail.com on 13 Aug 2013 at 7:53

GoogleCodeExporter commented 9 years ago
The API injection mechanism we are using at the moment only supports Web pages. 
 We'll consider this as a future enhancement.

Original comment by mfo...@google.com on 23 Aug 2013 at 10:53

GoogleCodeExporter commented 9 years ago
Can you at least tell to us developers how to inject cast API into extensions 
manually?

Can we include full background script cast extension has in our own extension 
and modify it so it will work with cast?

Original comment by gapipro@gmail.com on 24 Aug 2013 at 7:41

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
After making some research I found out that background_script.js already 
supports communication with extensions. 
Only thing that is currently unsupported is a way to add extension id to 
white-list for successful communication with Cast extension.

Currently in Cast extension version: 2.2013.10820.11008_0
If I add my extension Id to array "hl" on line: 13425 I am able to successfully 
fully control ChromeCast from extension.

Can you please add a way to white-list extensions for full support?

Original comment by gapipro@gmail.com on 25 Aug 2013 at 10:43

GoogleCodeExporter commented 9 years ago
Thank you for your support of Chromecast.  We've just released a major update 
to the Google Cast SDK and will be closing your issue.

Take a look at http://googledevelopers.blogspot.com/ for more information.

Check out the Chrome Sender SDK guide here: 
https://developers.google.com/cast/docs/chrome_sender.

All you need to do now is include as follows.

<script type="text/javascript" 
src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"></script>

Original comment by shawns...@google.com on 3 Feb 2014 at 11:35

GoogleCodeExporter commented 9 years ago
I don't think this should be re-opened. It's not really fixed. Just tried the 
new API in a packaged app. I stored cast_sender.js locally to work around CSP 
restrictions.

However cast_sender.js does access localStorage which is not available for 
packaged apps. When removing localStorage from cast_sender the API becomes 
available, but fails silently when calling requestSession()

The cast extension logs the following warning and does not show any UI:
 [cv2.CastService] [WARNING] only handle tab request now

I guess the UI depends on the extension popup window, which is not available 
for packaged apps.

Original comment by thembr...@gmail.com on 4 Feb 2014 at 11:14

GoogleCodeExporter commented 9 years ago
This needs to be reopened. 
The implementation defined in comment #5 does not work. 

It fails in chrome apps for two reasons. 
#1---The CSP issue
#2--- (when .js is stored locally) the localStorage api is not allowed. 

Comment #6 says the same thing, but since I haven't seen an update I felt it 
needed to be reiterated. 

Original comment by Jparris...@gmail.com on 8 Feb 2014 at 12:17

GoogleCodeExporter commented 9 years ago
Packaged apps are not currently supported.

Original comment by anad...@google.com on 8 Feb 2014 at 12:19

GoogleCodeExporter commented 9 years ago
Now that was lame move to set status to "WontFix" aka we don't care about 
packaged apps...

Original comment by gapipro@gmail.com on 8 Feb 2014 at 7:23

GoogleCodeExporter commented 9 years ago
It really sucks that chrome devs don't seem to want to support chrome. Makes 
tons of sense.

Original comment by TLSteinb...@gmail.com on 9 Feb 2014 at 2:05

GoogleCodeExporter commented 9 years ago
it is a matter of priority, it is something that we want to get to, but 
currently there are more pressing items that need to be addressed first

Original comment by anad...@google.com on 9 Feb 2014 at 2:07

GoogleCodeExporter commented 9 years ago
Agreed with @gapipro... Only one change to that JS file is needed to allow 
packed apps to be supported, and that's the use of the chrome.storage.local API 
instead of 'localStorage'... Oh, yeah, and a "chrome.cast.getDevices()" API to 
allow the packed app developer to display the list of devices inside the app 
instead of just launching the Cast extension, the way YouTube and Google Play 
Music/Movies, not to mention all the other developers that had access to the 
dev-preview SDK before the public SDK was released, already do it.

Original comment by Kenny.Strawn on 11 May 2014 at 6:30

GoogleCodeExporter commented 9 years ago
It would be nice to see this issue upgraded from a "wontfix" to something a bit 
more optimistic as the project member points out its a "matter of priority" not 
inability. 

Original comment by khe...@jct.io on 17 Jan 2015 at 7:22

GoogleCodeExporter commented 9 years ago
You guys make it so terrible difficult to program a good chromecast app. 
Incredible. 

Original comment by MarkusPf...@gmail.com on 7 Feb 2015 at 10:56