Open emacaya opened 8 years ago
Yes, me too. its not work on ios. @emacaya I do not know have you solved it yet? help me.
+1
Did you see any error on console?
Another way you can try is
gapi.client.load('https://xxxxx.appspot.com/_ah/api/discovery/v1/apis/quicktrack/v1/rest').then(...)
@bochunz nothing on console!! more: - chrome extension, safari (iphone/ipad) is ok. -simulate by phonegap developer app on android is ok.
Did a brief search, I think this is related. Since we use iframe, you need to somehow enable iframe in PhoneGap to make the library work. http://stackoverflow.com/questions/36835993/iframe-in-a-phonegap-app-on-ios-9-3-1
Thanks for your response, but i do not use frame, this example very simple execute a search request on youtube by youtube api v3.
@huynhvantuan The gapi library uses iframe for network requests.
Note that PhoneGap is also not a supported browser, and only http and https app pages are supported. See https://developers.google.com/api-client-library/javascript/start/start-js#supported-environments
I have tried many times, but not working. YoutubeApiExample project
YoutubeApiEx/www/index.html
index.html.txt
YoutubeApiEx/www/js/index.js
index.js.txt
YoutubeApiEx/config.xml
config.xml.txt
Project Structure:
Console log:
As @bsittler mentioned, PhoneGap is not officially supported by the gapi library. If you would like to get it work, I would still suggest first figure out if <iframe>
is supported in iOS PhoneGap app. The gapi library uses iframe under the hood.
Thanks @bochunz , I've searched and test all solutions for 3 weeks. but can not find any solution, and i found the problems caused by PhoneGap Developer App, not Youtube api or other configurations. The problem will be solved until be installed on real device (not any simulator) via TestFlight or itunes (published app). Everything work fine. Cause:
Same here on Windows Phone browser
I had the same problem.
SOLVED adding the following directives to config.xml
:
<access origin="https://*.google.com/*" />
<access origin="https://*.googleapis.com/*" />
<allow-navigation href="https://*.google.com/*" />
<allow-navigation href="https://*.googleapis.com/*" />
and wss:
protocol to the Content-Security-Policy (meta tag in index.html), like this:
<meta http-equiv="Content-Security-Policy"
content="default-src * gap://ready file: wss:;
script-src 'self' 'unsafe-inline' 'unsafe-eval'
127.0.0.1:*
http://*.google.com
http://*.googleapis.com
https://*.google.com
https://*.googleapis.com;
">
Explaination: you have to allow iframe generated by gapi.client.load()
to navigate to google APIs.
Hello I have a problem with gapi.client.load method, my callback never called. But it is working fine on android and google chrome browser. Here's my sample code