Chrome (Android) -- Casting authenticated HTML5 videos - android

Chrome (for Android) now overlays a Cast button on all HTML5 video content that it finds. The problem is that the content on our site requires authentication to view. Tapping the Cast button shows this toast:
"Unable to cast video due to site restrictions"
Is there a way to...
a) Provide the cast button with the necessary authentication params
and if not (a), then:
b) Provide a meta tag telling Chrome not to put a Cast button on our videos
We plan to provide Chromecast functionality in our Android app, but it's not done yet.

I think that you should add Access-Control-Allow-Origin: * to your CDN. look at this: https://developers.google.com/cast/docs/player check out the CORS Reference.
Works for me.

Related

Not able to return back to the app from ChromeCustomTabsBrowser

I have implemented login using ChromeCustomTabsBrowser. After successful login, if app's Open Supported links setting is set to "Ask evety time" instead of "Open in this app", response is not getting back to the app and showing 404 screen as attached in screen.
Interesting - looks like you are using an https scheme for redirects and here is how we'd like the technology to work:
You are automatically deep linked back to your app when a login response is received over the https URL.
However, in practice I believe this is what happens:
Almost all mobile browsers try to run an internet hosted web page instead
A claimed https scheme solution is very hard to achieve and rarely used in practice today - more of an aspiration than a reality? But I believe it would need to work like this:
Capture the response on the internet web page which runs on your mobile device
Then deep link back to the app
A similar approach is used by a sample internet web page of mine - do a view source to see the logic
If it helps I have a demo Android sample that instead uses the more mainstream option of private URI schemes - though I may update it to claimed https schemes one of these days.
Code
Explanatory Articles
Even getting this form of Chrome Custom Tab based login working was a struggle, and my posts have some lessons learned that may be useful.

Automate browser and native app

I want to use Appium to automate the scenario below on Android
First open a web page in Chrome. The web page contains a
registration form
Fill the form then click the submit button
The submit button open my native app via the uri (the same behavior
as we open the Google Play by clicking on a link market://...)
Finally interact with the app
I could make the automation for step 1 to 3 but stucked at step 4.
Is this possible with Appium? Is there any other testing framework which can automate the scenario like that?
It seems that the problem is related to changing from the webview context to the native app's own context. This is done in Java by using the command driver.context("NATIVE_APP");
To view all available contexts use driver.getContextHandles();, which returns a Set<String> with all available contexts.
Native context is always called "NATIVE_APP" and webviews usually are indexed as "WEBVIEW_0", "WEBVIEW_1" and so on.
All interactions to the app that are not related to a webview directly, will usually need to be done while in "NATIVE_APP" context.
It seem you have timeout exception, just change your code from driver.find_element(By.id("my_button_id"))
to
WebDriverWait(driver, 10).until(lambda:driver.find_element(By.id("my_button_id")))

Android Studio access webcam via WebView

I'm trying to access and display a webcam interface in my application.
Currently I'm trying to do that using a WebView (still no success), but open to other suggestions.
When I go to "http://192.168.43.74:81" (the ip of the camera) on my phone's browser I get a popup asking me to insert a username and a password, I do that and log the camera successfully.
This is how I try to do that using a WebView:
WebView camera = (WebView) findViewById(R.id.camera);
camera.getSettings().setJavaScriptEnabled(true);
camera.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
camera.loadUrl(CAMERA_URL);
camera.setWebViewClient(new WebViewClient());
When I set CAMERA_URL to google's url for example, I'm able to access google and browse the internet normally, using the webview. When I set CAMERA_URL to the webcam's IP, I get a blank page on my webview, and the following message:
Access Error: Unauthorized
Access to this document requires a User ID
This is the same message I get when I try to log in via my browser, but hit cancel instead of trying to log in. I assume I'm doing something wrong, and would appreciate some help:
How do I make it work?
Is there a better way to go about it than a WebView?
and finally, though a somewhat different question, is there a way to automatically make the login instead of having the user type the username/password every time?
I apologize if this question is trivial, or has been asked before. I was unable to find a solution by searching. Thank you!

Android app - private viemo videos not playing

I'm currently developing an android mobile app. I see that private Vimeo videos are not playing. Check the attached screen shot. Also note that the android app is still on development mode and not uploaded to Google. Please help me in this regard.
Regards,
Niladri!
private vimeo video not playing
That picture appears to be accessing vimeo.com directly to view videos. At vimeo.com, private videos can only be viewed if you are logged in (which is unrelated to the API).
If you want to play a private video in your application you will need to follow one of the following workflows:
Embedded in a webview
Mark your video as hidden from vimeo, yet embeddable, in your video's settings
Make an API request to /videos/{video_id} and extract the embed code from the response body (response.embed.html)
Put the embed code in your webview's html
Played in the Native Player (Vimeo PRO only)
Mark your video with any privacy setting
Make an API request to /videos/{video_id}
Find the collection of video files (response.files)
Loop through the video files to find the best height and width for your target player
Load the link into your native player
You can read more about the Vimeo API at https://developer.vimeo.com/api, and https://developer.vimeo.com/api/endpoints
If you want to play private Vimeo videos of your Vimeo account in an Android Application then follow the steps below:
Go to your video privacy settings and mark it as hidden from Vimeo and embed anywhere.
Make an API request to this endpoint: https://api.vimeo.com/users/{your_user_id}/videos
Get the embed.html string from the API response.
Load embed.html obtained in the previous step into your WebView.
For Vimeo Android SDK: https://github.com/vimeo/vimeo-networking-java
You can retrieve the Video endpoint by calling an auth-enabled REST API and then play it using a player(I used Exoplayer in android).
Follow below steps:
API Registration: You will need an application registered with the Vimeo API. If you do not already have an application registered, you can do so here.
You can generate an access token in the Authentication tab once you select your app from the list here.
With this access token you'll be able to make any requests that the access token's scope allows. You will NOT be able to switch accounts if you only supply the access token.
Call rest API with the access token in the header like below
Endpoint:
https://api.vimeo.com/videos/{VIDEO_ID}
Header:
Authorization:bearer ACCESS_TOKEN
VIDEO_ID is the id of video uploaded to Vimeo(Some number eg: 45334535)
ACCESS_TOKEN is the token you got after API Registration
This steps worked for me. I hope this will help someone.
We have a special google's SDK for YouTube for instance. On the other side AOS does not support Adobe Flash. Maybe its just has an unsupported by AOS video codec used by vimeo service? That could be the reason why you cant watch vimeo videos via WebView/browser.
Did you check for Vimeo official Android SDK if such thing does exist at least?
Also check this
And a little suggest: try to use SO search and google - it helps in most cases :)

oAuth support in a WebView

So I've created a simple WebView application that wraps an already existing mobile friendly site and displays it on the device. I've enabled javascript, supported screen orientation changes, etc...
I've run into an issue with the oAuth support though. Accessing the site from the chrome browser on the device, everything runs fine.
If I try to access the site from the app/WebView, it will push me over to the oAuth screen, let me input credentials and everything, but the moment it tries to push me back to the website and log me in, I get this:
Failed to recognize URL query:
https://exittix.com/frontend/login/redirect.html#access_token=******************************&expires_in=********&state=****client_id=******************network*****facebook*****display***popup****callback****_hellojs_agj27sx5****state****oauth_proxy***https***auth-server.herokuapp.com%2Fproxy***scope***basic_profile***email***basic***oauth***version***auth***https***facebook.com%2Foauth***
The * is used to protect data.
So, any ideas why oAuth isn't working inside a JS enabled webview but works fine in the mobile chrome browser for android?
Thanks in advance for your help!
EDIT:
Ok, so I've tracked the error I'm getting back to redirect.html.
This page calls some javascript. If the javascript fails to redirect, then it displays that error I have above instead.
The javascript being called to handle the oAuth is Andrew Dodson's hello.js script.
You can see it HERE.
I've concluded that the second half of the error's url is indeed the unhandled JSON.
Here's what the returned data looks like after I've decoded it from the URL encoded characters:
{"client_id":"************.apps.googleusercontent.com","network":"google","display":"popup","callback":"_hellojs_********","state":"","oauth_proxy":"https://auth-server.herokuapp.com/proxy","scope":["https://www.googleapis.com/auth/userinfo.profile","https://www.googleapis.com/auth/userinfo.email","basic"],"oauth":{"version":2,"auth":"https://accounts.google.com/o/oauth2/auth"}}&access_token=***.*.*****_*********************************************************&token_type=Bearer&expires_in=3600
Any ideas why this isn't getting handled properly in the WebView?

Categories

Resources