Unhandled Promise Rejection: Error: Untrusted URL when I load Youtube video inside WebView on JavaFX - promise

When I load a Youtube video using WebView directly from YT, I get all the page data, but the video stays charging without showing the video itself. This issue is new because the previous week that worked adequately.
I suppose that Youtube has made some changes to prevent embedding video pages inside JavaFX WebView component.
Please use the following repository to see a test.
https://bitbucket.org/diegoluisr/javafx-webview-youtube-test/src/master/enter link description here
WebKit browser prints in the console the following lines...
Console: [https://www.youtube.com/yts/jsbin/player_ias-vflPI0brM/en_US/base.js:39] Unhandled Promise Rejection: Error: Untrusted URL: https://r3---sn-qpgxju8jva-cvbe.googlevideo.com/videoplayback?expire=1564559165&ei=3PJAXYPFN7n6j-8Podm9WA&ip=191.102.199.174&id=o-AFpZ9-9BjKhhYLbO9zoBJ-koAlgU4_rl5mhm-RAcZPp2&itag=22&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-qpgxju8jva-cvbe%2Csn-hp57knly&ms=au%2Crdu&mv=m&mvi=2&pl=24&ctier=L&initcwndbps=236250&mime=video%2Fmp4&ratebypass=yes&dur=10.100&lmt=1563964109911459&mt=1564537439&fvip=2&c=WEB&txp=5316222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cctier%2Cmime%2Cratebypass%2Cdur%2Clmt&sig=ALgxI2wwRgIhAND23sayeeFGInqso6n2wt5VI1-8CmEwn3BS7KEqdFZ0AiEAokZIzzORQLnQLDhnoUmK6gSJP1FxDnpJAIcPNOVxoxg%3D&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRQIgH9Mxi8qnf2E1yvcvfA8gjeJTBKe_kKBklEhjz82gWK4CIQCX6D8qZbu-Dpy-NkCRcluo-OOLSzuu8mgEwgni5_8RFA%3D%3D
Console: [https://www.youtube.com/yts/jsbin/player_ias-vflPI0brM/en_US/base.js:39] Unhandled Promise Rejection: Error: Untrusted URL: https://r4---sn-qpgxju8jva-cvbe.googlevideo.com/videoplayback?expire=1564559175&ei=5_JAXe6MCoS2lAOI14eoBA&ip=191.102.199.174&id=o-ALfOT4rp_IeL6a86s4a2nTlmva4YgQkA9yc_o-ma4_hG&itag=22&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-qpgxju8jva-cvbe%2Csn-hp57knzz&ms=au%2Crdu&mv=m&mvi=3&pl=24&ctier=L&initcwndbps=236250&mime=video%2Fmp4&ratebypass=yes&dur=119.559&lmt=1563514693761974&mt=1564537439&fvip=4&c=WEB&txp=5316222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cctier%2Cmime%2Cratebypass%2Cdur%2Clmt&sig=ALgxI2wwRQIhAI-C_mVNjdJNzAK249RkB62Blm7jw1_FjwQvkebmhCMUAiBOzmlsdMCZriM9VSmcAVM-BzxzGpcK49kHGg8izPQfVA%3D%3D&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRAIgMRZJB2yOLTSlIgblsfaMsK56HcO6MQ6bklYQDnLczM4CIGXeJsTlmhBTDodytkm2jO5Gc6SmY6Q6sjQmwVrUXnvH
Console: [https://www.youtube.com/yts/jsbin/player_ias-vflPI0brM/en_US/base.js:39] Unhandled Promise Rejection: Error: Untrusted URL: https://r2---sn-qpgxju8jva-cvbe.googlevideo.com/videoplayback?expire=1564559162&ei=2vJAXYWoHOXbj-8Prs-DgAo&ip=191.102.199.174&id=o-AO7C5x6ZIyPXAr2qK_vIPflPjs-AOMY2IJVZliAV72Cp&itag=18&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-qpgxju8jva-cvbe%2Csn-hp57kn6e&ms=au%2Crdu&mv=m&mvi=1&pl=24&initcwndbps=236250&mime=video%2Fmp4&gir=yes&clen=19015393&ratebypass=yes&dur=348.856&lmt=1537207191333104&mt=1564537439&fvip=2&c=WEB&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRQIgW0bSjfFcOWJAwx2_jlafwhDh5-QSE4QaHLllKQUCoXgCIQCcEWzrSiuhAAj9ibUukTnM9_Z7Ln8u8ZbxH4gfqid-fw%3D%3D
You could notice three console lines, that is because the player tried to load 2 Advertising video before the "Alice in Chains" video.

I solve my problem working around it; I have to use a commercial component named JxBrowser. This component uses a chromium implementation (version 69) that allows the embed player to work, and disable gestures required to autoplay.
You could find more information on the component website
https://www.teamdev.com/jxbrowser

Related

How do I detect when embedded Youtube video is playing?

UPDATE (July 2020): I was able to get a mostly working version of this. See my answer to the related question here.
In my angular Nativescript iOS app, I have a webview set up to play youtube videos. Following a method similar to this question here, I can get the youtube video to load and play automatically, using the Youtube Iframe API. But how do I detect when the video actually starts playing (after it is loaded)?
The Iframe API has events for this purpose, like "onStateChange". But, because my youtube code is "stuck" inside the webview, I am currently not able to read when events are fired from that webview.
In Nativescript, there is a nativescript-webview-interface plugin for this purpose, but I can't get it to work. I have put my code below. If that is the way to go, what is the correct code to get it working?
(I don't want to use the nativescript-youtube plugin because that brings in youtube's quotas, which are regularly shrinking. )
Code I Have Tried:
To get the youtube player to activate, I have put all of the relevant youtube code inside the webview. That works to play the video, but not yet to get the event of when the player starts playing. To do what I want to do, I need to have some way of inserting that code into my app WITHOUT trapping it in the webview. Or, have some way of communicating inside the webview.
To try to communicate with the webview, I have tried the nativescript-webview-plugin:
$ tns plugin add nativescript-webview-interface
html:
<web-view src="{{youtubeCode}}" #webView ></web-view>
ts:
import {WebView, LoadEventData} from "tns-core-modules/ui/web-view";
let webViewInterfaceModule = require('nativescript-webview-interface');
...
export class ...{
#ViewChild('webView') webView: ElementRef;
public youtubeCode = [code that youtube provides in its IFrame API]
ngOnInit(): void {
this.setupWebViewInterface();
}
setupWebViewInterface() {
let webView: WebView = this.webView.nativeElement;
this.oWebViewInterface = new webViewInterfaceModule.WebViewInterface(webView, '~/www/index.html');
this.youtubeListen()
}..
youtubeListen(){
this.oWebViewInterface.on('onStateChange', (eventData)=>{ //'onStateChange' is the event provided in the Youtube Iframe API
console.log('event data = ' + eventData) //***this is the key part I want to work.
});
}
RESULT: ERROR TypeError: undefined is not an object (evaluating 'this.webView.ios.constructor')
This is a problem in the plugin's index.ios.js file. If I comment out the offending line, then the errors go away, but then nothing happens
..

Parse related remote calls failing in app

I have developed an Ionic Framework App using Parse which works great on my desktop browsers. No errors or warnings in the browser console.
But when I package the app and test in on my actual Android 4.4.4 device, the Parse related functionalities does not work. When I tried to debug the App by installing the .apk using GapDebug tool, I see the below in the console.
POST https://api.parse.com/1/login net::ERR_CACHE_MISS
POST https://api.parse.com/1/requestPasswordReset net::ERR_CACHE_MISS
Below is the complete console log details for the Parse Login activity.
POST https://api.parse.com/1/login net::ERR_CACHE_MISS parse-1.3.3.min.js:1
b._ajax parse-1.3.3.min.js:1
b._request parse-1.3.3.min.js:1
b.User.b.Object.extend.logIn parse-1.3.3.min.js:3
b.User.b.Object.extend.logIn parse-1.3.3.min.js:3
$scope.validateUser login.controller.js:22
$parseFunctionCall ionic.bundle.js:20124
(anonymous function) ionic.bundle.js:50863
Scope.$eval ionic.bundle.js:22178
Scope.$apply ionic.bundle.js:22276
(anonymous function) ionic.bundle.js:50862
jQuery.event.dispatch jquery.js:4409
elemData.handle jquery.js:4095
triggerMouseEvent ionic.bundle.js:2811
tapClick ionic.bundle.js:2800
tapTouchEnd ionic.bundle.js:2918
POST https://api.parse.com/1/requestPasswordReset net::ERR_CACHE_MISS
For getting all the data for a particular class, I get the below failure object.
Failed to load resource: net::ERR_CACHE_MISS https://api.parse.com/1/Items
XMLHttpRequest failed: {"statusText":"","status":0,"response":"","responseType":"","responseXML":null,"responseText":"","upload":{"ontimeout":null,"onprogress":null,"onloadstart":null,"onloadend":null,"onload":null,"onerror":null,"onabort":null},"withCredentials":false,"readyState":4,"timeout":0,"ontimeout":null,"onprogress":null,"onloadstart":null,"onloadend":null,"onload":null,"onerror":null,"onabort":null}
The issue was with permission. It was failing because the app was not able to connect to internet.
Somehow the Network Access permission entry got deleted in the manifest file. After adding it to manifest, it worked.

Admob Error, clearing app data fixes it, but that's not viable

My Admob adverts are not loading:
01-13 00:13:56.942: E/Ads(28232): JS: Uncaught ReferenceError: AFMA_getSdkConstants is not defined (http://media.admob.com/:1)
01-13 00:13:56.942: E/Web Console(28232): Uncaught ReferenceError: AFMA_getSdkConstants is not defined at http://media.admob.com/:1
A lot have said that this error means there is no network connection. There certainly is.
Now for the weird part, if I clear the data of the app e.g. Settings/Apps/MyApp/Clear Data, the next time I run the program the adverts will load fine. But obviously I cannot tell my users to clear their data so I can show them adverts!
Any ideas why I have an issue with the app data? And how to fix it.

Creating a player app on chromecast

I've had lots of progress on this and wanted to implement the "invisible player" on the chromecast receiver as explained here:Deezer invisible player
I have my demo app running, and am able to pass from the sender to the receiver my access token and my token expires.
Instanciating the DZ player like so:
DZ.init({
appId : deezer_app_id,
channelUrl : deezer_channel_url,
player : {
onload : onPlayerLoaded,
token : {
accessToken:event.message.accessToken,
expire:event.message.expire
}
}
});
the onPlayerLoaded function just logs a message for the time being.
I am currently getting:
Unsafe JavaScript attempt to access frame with URL http://mydomain/chrome/myreceiver.html from frame with URL http://www.deezer.com/es/plugins/player.php?channel=http://Mydomain/chrome/channel.php&app_id=IDVALUE&emptyPlayer=true. Domains, protocols and ports must match.
external-v00202097.js:40
FB.getLoginStatus() called before calling FB.init(). vb.js:56
Flash is not installed or is too old vb.js:56
Unsafe JavaScript attempt to access frame with URL http://mydomain/chrome/myreceiver.html from frame with URL http://static.ak.facebook.com/connect/xd_arbiter.php?version=27#channel=f3a…Ffb_xd_fragment%23xd_sig%3Df2d6a19d8%26&origin=http%3A%2F%2Fwww.deezer.com. The frame requesting access set 'document.domain' to 'facebook.com', but the frame being accessed did not. Both must set 'document.domain' to the same value to allow access.
xd_arbiter.php:18
Unsafe JavaScript attempt to access frame with URL http://Mydomain/chrome/myreceiver.html from frame with URL https://s-static.ak.facebook.com/connect/xd_arbiter.php?version=27#channel=…Ffb_xd_fragment%23xd_sig%3Df2d6a19d8%26&origin=http%3A%2F%2Fwww.deezer.com. The frame requesting access has a protocol of 'https', the frame being accessed has a protocol of 'http'. Protocols must match.
now the first one does not make sense, as I have my channelURL set to the same domain, looking with the inspector I can guarantee both on the channelURl and on the chrome cast receiver that we have the same document.domain .
the second error seems to be from deezer loading something in flash (weird as the example does not state anything in flash).
the third error would be deezer calling FB for some reason.
I know the youtube api through Iframe has been made to work with chromecast, so I think this is possible, however the flash problem and cross domain seems to be an issue.
Any advice?
About the domain, sometimes you get errors when the domain you specified for your app on http://developers.deezer.com contains http:// as it shouldn't.
About Flash, the Deezer player is based on Flash for encryption so you need to install it to get it to work.
Facebook is included in the Deezer player (for sharing, login purposes) and you get warnings when your page is loaded within iframes. You can ignore these warnings.
I am not familiar with Deezer so won't be able to comment on Deezer related issues but the "Unsdafe ..." message can also be caused by trying to use file://*; this is an additional security measure in Chrome. In addition, what are the sanbox properties of the iframe? Does it include "allow-same-origin" ?

Strange error with canvas context getImageData function in Firefox 13

I have some canvas code that works great in safari and chrome, but fails in firefox.
The firefox console reads:
[17:44:13.372] uncaught exception: [Exception... "Operation is not supported" code: "9" nsresult: "0x80530009 (NotSupportedError)" location: "http://REDACTED.js Line: 703"]
Firebug gives the slightly-more-useful-to-humans:
Operation is not supported
var data = ctx.getImageData(x,y,1,1);
I am indeed calling .getImageData on line 703.
I have read that similar errors have been reported with regards to origin policies. This project is hosted on a web server (not local), and I haven't loaded any images from a different domain and put them on the canvas. In fact, I get the error even if the canvas is blank.
The webkit-based browsers give me the pixel data as asked, what can be done about firefox? Thanks.
Don't pass NaN to .getImageData.

Resources