Video's suddenly stopped playing from Youtube API - android

We've been using the Youtube API in our Android Application for about 3 months now, we removed alot of old video's the last couple of days and updated our MYSQL server where the video ID's are stored.
We made 60 video's add dynamically (using the MYSQL) in our main screen, and i've added about 6 video's 'hardcoded', so nothing should have gone wrong there.
Suddenly all the video's won't play inside the application and give the error "There was a problem while playing, touch to retry". I can keep tapping but nothing happens. I do see that it is loading the right video.
If I keep tapping the bottom right corner, where the link to the youtube web/app is, then it will load the video inside the normal youtube application. It is working fine inside the normal Youtube App.
What I tried so far:
Restarted my device
Uninstall my application and installing it again
Switch from WiFi to 3G
Tested a friends phone who also has the application
Generating a new Youtube_API_KEY and adding it to the application
Tried multiple Youtube accounts, even tested without being logged into Youtube
None of the above mentioned attempts worked.
Does anyone mayby has a clue where to look?

I had an issue earlier with the YouTube API, and the bug was introduced with a specific version of the YouTube app. That is, the presence of the bug in my application depended on the installed version of YouTube.
If you go to Settings > Apps > YouTube, tap Uninstall Updates, you can install another version of YouTube directly with an .apk file downloaded from here, for example.
Install an earlier version of YouTube for a temporary solution. You may want to raise an issue at the issue tracker for YouTube, and wait for the fix.

I encountered such a problem, some videos can be played only in the YouTube player. To circumvent this problem, we had to pump out all the videos from youtube and use the id of the video.

have you tried this code snippet
/**
* Method used to play video in a new activity
*
* #param context the activity context
* #param url the url of the youtube video to be played
*/
public static void playVideo(Context context, String url) {
String ytId = extractYTId(url);
if (ytId != null && ytId != "") {
Intent videoIntent = YouTubeStandalonePlayer.createVideoIntent((Activity) context, DEVELOPER_KEY, ytId, 0, false, false);
context.startActivity(videoIntent);
} else {
Toast.makeText(context, "this is not youtube url!", Toast.LENGTH_SHORT).show();
}
}
you just have to add youtube Api .jar and call this method then hope so your video will play..
enjoy your code time:)

If you go to Settings > Apps > YouTube, tap Uninstall Updates, you can install another version of YouTube directly with a .apk file downloaded from here for example.

Related

How to integrate Vimeo on Android and Website with specific user access

we have purchased a VIMEO account for video streaming. Our websites and android app are running and the user-level restriction to contents is managed by firebase generated token. Now I want to integrate the VIMEO video's to be accessed by our site and app and want to ensure those videos to be accessed by the desired user only with the corresponding token.
we are now just showing the videos on our site using iframe + domain-level protection + making it private though it can be downloaded sometimes. but it is not possible to manage different user levels to access different videos only. Also struggling to integrate it in android for domain-level protection. Is it like a hardcoded client token to show videos on App or I have to use Vimeo player or API and how?
Saw some documentation for android but those seem unclear to me. Please suggest
It was really painful experience of support we are getting with the paid service from vimeo, their documention for specific or popular use-cases are super unclear. I did manage to implement my use case though not sure that whether it is the best practice or not. I will describe the the experience as details possible :
We moved from Vimeo Plus to Vimeo Pro account (As noone can even get the access of vimeo GET api or video file access from from api without Pro account which is must)
for our Website use-case we have hidden the private video from vimeo and only allowed it to be embedded in our site (though if anyone check the network he can use the the server responded html with limited time token anywhere for short time)
for Android use-case as it is browserless we followed https://github.com/vimeo/vimeo-networking-java and used hardcoded access-token for that and played in exoplayer (as I will have to encrypt it later or I have to r&d more for dynamically get access token for limited time when playing video using Oauth. But the problem is the documentation is super unclear which didn't even properly illustrate the life span of different tokens just said it depends on the way of creating or scope)
Coding :
confBuilder = new Configuration.Builder(accessToken);
// this access token has public+private+video file access created in the vimeo account manually
configuration = confBuilder.build();
VimeoClient.initialize(configuration);
VimeoClient.getInstance().fetchContent(url, CacheControl.FORCE_NETWORK, new ModelCallback<Video>(Video.class){
//here url should be like "videos/{video_id}" otherwise it wasn't working whatever the url was
#Override
public void success(Video video) {
//progressBar.setVisibility(View.GONE);
if(video != null){
Play play = video.getPlay();
if (play != null) {
//in my case "play" was null, but here I should get the direct link to varioud resolution files
VideoFile dashFile = play.getDashVideoFile();
String dashLink = dashFile.getLink();
// load link
VideoFile hlsFile = play.getHlsVideoFile();
String hlsLink = hlsFile.getLink();
// load link
ArrayList<VideoFile> progressiveFiles = play.getProgressiveVideoFiles();
String linkToMp4File = progressiveFiles.get(0).getLink();
//loadVideo();
}
//I got the link from here
ArrayList<VideoFile> videoFiles = video.files;
if(videoFiles != null && !videoFiles.isEmpty()) {
VideoFile videoFile = videoFiles.get(0); // you could sort these files by size, fps, width/height
String link = videoFile.getLink();
finalLink = link;
// load link
RunExoplayerPlayerWithThisLink();
// but this is http link which will redirect to https link which u have to handle in exoplayer
}
}
}
#Override
public void failure(VimeoError error) {
progressBar.setVisibility(View.GONE);
Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show();
}
});
Now I have to handle Http to Https redict link in exoplayer which is restricted
in exoplayer by default. so you have to set "allowCrossProtocolRedirects" to "true" in DefaultHttpDataSourceFactory which will be needed in MediaSource while playing video in exoplayer :
DefaultHttpDataSourceFactory factory;
ExtractorsFactory extractorsFactory;
MediaSource mediaSource;
factory = new DefaultHttpDataSourceFactory("exoplayer_video",null, DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,true);
extractorsFactory = new DefaultExtractorsFactory();
mediaSource = new ExtractorMediaSource(videoUri, factory, extractorsFactory,null,null);
Give me any suggestion in this topic if you think that the way could be better specially regarding access_token.specific user access implementation, I think cannot be fully possible. I just can send the link after authentication or checking user access from backend.
But there is still an issue regarding Android 10 platform (api 29) which doesn't allow some method used in the current version of the Vimeo Networking library regarding "sslSocketFactory" (Caused by: java.lang.IllegalStateException: Unable to extract the trust manager on Android10Platform, sslSocketFactory is class com.android.org.conscrypt.OpenSSLSocketFactoryImpl) which I asked (solved) in another post (Vimeo Networking Library Crash for Android 10 platform (api29))

Firebase PendingDynamicLinkData is sometimes null

I'm trying to implement Firebase dynamic links in my app.
I'm using custom domain of mine (instead of the one provided by firebase).
It works most of the time.
However, on a specific device (Samsung A7), the dynamic link is sometimes null
Here's the standard code for pulling the dynamic link:
FirebaseDynamicLinks.getInstance().getDynamicLink(intent).addOnSuccessListener { dynamicData ->
val link = dynamicData?.link
if (link != null)
{
Log.i(TAG, "pullDynamicLinkAsync", "dynamic link found")
}
}.addOnFailureListener {
Log.i(TAG, "pullDynamicLinkAsync", "dynamic link not found")
}
The steps of my test:
Click on the shared dynamic link -> Play store page of my app (previous version) gets opened
Make a fresh install of the app from Android Studio
Call the above code directly from onCreate method
As I said, most of the time it works and I get the link.
Could it be an issue related to the specific device? Maybe Play services issue? Or limitation?
EDIT (03/12/2020):
It seems like this issue is somehow related to Chrome browser.
When I press the dynamic link and the browser (in this case - chrome), opens, The following line gets printed in the log most of the time:
**I/ActivityManager: START u0 {act=com.google.firebase.dynamiclinks.VIEW_DYNAMIC_LINK ...**
If the line appears in the log, I always received the dynamic link in my app
If the lines doesn't appear in the log, I never receive the dynamic link in my app
The issue happens only with chrome browser.
If I open the link with other browser (Firefox, build in browser..) it always works.

App doesn't open chrome if Terms & Conditions are not accepted

I'm building an app using Xamarin.Android which is meant to open a URL in Chrome when a user taps on a cell. Everything was working just fine up until a couple of hours ago. It was working fine on one device but not on another. There was no indication as to why it was not opening Chrome on one of the phones. After some time, I manually opened Chrome to make sure that everything was alright with it and found out that it had automatically updated itself a couple of minutes earlier and I had not accepted their Terms & Conditions. After accepting them, everything was working just fine again.
My issue is that there is no indication that the problem is with Chrome's EULA and it looks as if my app is the one which has the problem.
I'm using the code below to launch the URL using the CustomTabsLibrary:
var intent = builder.Build ();
var mgr = new CustomTabsActivityManager (this);
mgr.CustomTabsServiceConnected += delegate {
mgr.LaunchUrl ("http://xamarin.com", intent);
};
mgr.BindService ();
The callback below gets called when Chrome is not installed on the device, but this not the case. In our case if the user does not accept the EULA of Google Chrome's app, we don't have any available callback to know and as a result, it doesn't redirect the user to the URL.
if (!mgr.BindService ()) {
// Cannot use Custom Tabs,
// Launch the URL another way
}
Has anyone ever had this issue before? Is there any way we can solve this issue?
CustomTabsLibrary
Relevant question on Stackoverflow
It appears that Google has now fixed the issue on Chrome. When TOS have not been accepted by the user, the callback is now called and launches Chrome, as it should, taking you to the screen where you can accept the TOS.

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 :)

Android Play Store market:// link is no longer working?

I've been redirecting my users for the past year from my domain:
http://example.com/get
to: market://details?id=com.example.myapp
Today I've check this on Nexus 5/LG G3/OnePlus One from the chrome browser app and it stopped working!
Now, when my users try to download the app they are redirected to a broken link.
Anyone know anything about this change in the Chrome app in Android?
from reading the chrome's version 40 release, there are some insight i d like to share
http://blog.chromium.org/2014/12/chrome-40-beta-powerful-offline-and.html
they updated to Content Security Policy Level 2, which has a stronger control over redirects.
https://w3c.github.io/webappsec/specs/content-security-policy/#changes-from-level-1
The path component of a source expression is now ignored if the resource being loaded is the result of a redirect, as described in ยง4.2.2.3 Paths and Redirects.
Redirects are blocked by default, and explicitly allowed with a new unsafe-redirect expression.
So I did some testing. if your initial action started from redirect (no matter window.location or http 302) it will show an error. but once i created a hyperlink to market:// and explicitly clicked it, it worked fine.
for now i ended up creating a webpage in between, where i ask the user to click the link to proceed.
I was testing this url on different devices with different OS/Play Store/ Play Services/ Browsers. looks like it's related to browser but not OS or Play Services.
Initially I updated Play Services and Google Play Store and my old Chrome (v18) was opening market://details?id= url fine.
Afterward I had updated my Chrome (v18) to version 40. And it's not working any more.
Meanwhile, FireFox and default "Browsers" still opens this url and redirects to Google Play Store app.
P.S. I have registered issue in Chromium bug tracker. Let's see if there will be any response:
https://code.google.com/p/chromium/issues/detail?can=2&q=market&colspec=ID%20Pri%20M%20Week%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&id=454396&thanks=454396&ts=1422888121
UPDATE [6.05.15] : Unfortunately, they decided not to fix this issue, saying, that it's planned behaviour. As they said, user should click the link by himself. Only then re-direct to the app on devices is allowed.
So, there is only one "work-around", that I see for now: create a page, that contains text like "Click link below to go to the app", followed by link like:
Load Example App
or
<a href="intent://foo.bar#Intent;scheme=blabla;package=com.example.myapp;end" > Load App/ Activate your Profile </a>
Try the link below, replacing your.app.id with your own identifier:
https://play.app.goo.gl/?link=https://play.google.com/store/apps/details?id=your.app.id&ddl=1&pcampaignid=web_ddl_1

Categories

Resources