vimeo-networking-java
vimeo-networking-java copied to clipboard
Always get play object null.
Issue Summary
A brief but thorough description of the issue.
Reproduction Steps
Detailed steps to reproduce the issue.
Expected Behavior
What do you expect to happen as a result of the reproduction steps?
Actual Behavior
What currently happens as a result of the reproduction steps?
all these requirements are filled, but I cannot get play object.
Pls help to check thanks
I have the same.
private fun getVideo(url: String): Video? {
val video = VimeoClient.getInstance().fetchVideoSync(url, null)
video?.body()?.apply {
} ?: Assert.fail(video?.toString())
return video?.body()
}
@Test
fun getVideoFile() {
getVideo("videos/${ID}")?.let {
it.getPlay()?.let { play ->
// NO! play is null!
}
}
}
It was configured:
val configBuilder: Configuration.Builder =
Configuration.Builder("SECRET", "SECRET", "video_files")
.setCacheDirectory(this.cacheDir)
VimeoClient.initialize(configBuilder.build())
// VimeoClient is now ready for use
With my keys I see "files" in response when I use Postman.
Hello,
I actually replicate the same issue, despite my ability to see thoses files through postman i never have it within through the SDK :
Here is my Configuration :
VimeoApiConfiguration.Builder configBuilder = new VimeoApiConfiguration.Builder("cliendID", "secretID", new ArrayList<ScopeType>(Arrays.asList(ScopeType.PUBLIC,ScopeType.VIDEO_ FILES, ScopeType.PRIVATE)));
Authenticator.Companion.instance().authenticateWithClientCredentials(new VimeoCallback<VimeoAccount>() {
@Override
public void onSuccess(@NotNull VimeoResponse.Success<VimeoAccount> success) {
String accessToken = Authenticator.Companion.instance().getCurrentAccount().getAccessToken();
Log.d("[VIMEO]", "Client Credentials Authorization Success with Access Token: " + accessToken);
}
@Override
public void onError(@NotNull VimeoResponse.Error error) {
String errorMessage = error.getMessage();
Log.d("[VIMEO]", "Client Credentials Authorization Failure: " + errorMessage);
}
});
As you can see i log the generated token, and when i use this one in Postman, i do not see the "files". So obviously the generated token is not granted the correct rights =)
Actually i tried using
https://api.vimeo.com/oauth/authorize/client?grant_type=client_credentials&scope=public private video_files
turns out that even if the answer is :
{
"access_token": "****",
"token_type": "bearer",
"scope": "public private video_files",
"app": {
"name": "***",
"uri": "****"
}
}
The access_token still don't give you any "files", it only seem to work using generated personal token in my case.
Finally since i didn't found a way to log through token as before, after the first authenticate it tried
Authenticator.Companion.instance().exchangeAccessToken("**working_token***",new VimeoCallback<VimeoAccount>() {...}
And i finish with
Client Credentials Authorization Failure: API error: 5000
That's all i got.
Thanks in advance
same issue
Sorry that we didn't get around to answering this, and I'm sure y'all probably figured it out by now, but in case you haven't here's what's probably happening.
Authentication with client credentials alone does not actually log you into the account. If you authenticate with client credentials, e.g. Authenticator.instance().authenticateWithClientCredentials(...)
you're essentially saying to the API "hey, i don't want to use my client id/secret combo to make requests anymore, give me an auth token i can use as a logged out user." To actually be really logged in, you need to authenticate using Authenticator.instance().authenticateWithCodeGrant()
, which requires you to direct the user to the browser and then accept the redirect back to your app. There is an example of this in the auth README as well as in the example Android app in this repository.
The new 2.0.x version of the library has the ability to initialize using an access token, which is the approach I would suggest using. Then you can generate your access token on the Vimeo developer website with the exact access you need and then initialize the client with it without needing to use code grant authentication.
val configuration = VimeoApiConfiguration.Builder(accessToken).build()
Authenticator.initialize(configuration)
VimeoApiClient.initialize(configuration, Authenticator.instance())
Hey, I'm doing the java version of what you posted above:
protected VimeoApiClient doAuthToken() { String token = "1b75e77e312387c3b83c608aa5ac2879"; VimeoApiConfiguration.Builder vimeoApiConfigurationBuilder = new VimeoApiConfiguration.Builder(token); vimeoApiConfigurationBuilder.withCertPinning(false); VimeoApiConfiguration vimeoApiConfiguration = vimeoApiConfigurationBuilder.build(); Authenticator.initialize(vimeoApiConfiguration); Authenticator authenticator = Authenticator.instance(); VimeoApiClient.initialize(vimeoApiConfiguration, authenticator); VimeoApiClient vimeoApiClient = VimeoApiClient.instance(); return vimeoApiClient; }
running in debug I can then see that I successfully pull a video object back from vimeo but the 'play' object is empty; and the player in my app just gives a message saying it can't play the video when I try calling it using the URI from the video object like this:
vimeoApiClient.fetchVideo(uri, null, null, null, new VimeoCallback<Video>() { @Override public void onSuccess(@NotNull VimeoResponse.Success<Video> video) { System.out.println("Got video"); // use the video Uri uri = Uri.parse(video.getData().getUri()); if (Objects.nonNull(uri)) { System.out.println("Ok, I'll try and play it"); VideoView videoView = (VideoView) findViewById(R.id.videoView1); mediaController.setAnchorView(videoView); videoView.setMediaController(mediaController); videoView.setVideoURI(uri); videoView.requestFocus(); videoView.start(); } else { System.out.println("I won't try and play it"); } }
I'm specifically using vimeo as a place to store the videos I display through my app, so if this doesn't work, I have to find an alternative to vimeo!
I'm facing the same issue as well, using version 2.0.0-alpha.94 and access token initialization. I am able to get other data but the Play object is always null.
I'm facing the same issue as well, using version 2.0.0-alpha.94 and access token initialization. I am able to get other data but the Play object is always null.
I raised a support ticket for it with vimeo and pointed them at this conversation in github. I still haven't got a reply from them, in the end I got my money back from vimeo and am now working with Mux - which is the only back-end video store I've found that actually works as it says it will. I recommend you do the same.
implementation "com.github.vimeo.vimeo-networking-java:vimeo-networking:2.0.6"
implementation "com.github.vimeo.vimeo-networking-java:models:2.0.6"
Same issue. Using an access token from a PRO account with scopes public private video_files
, I can retrieve a Video
that contains a download
object but not a play
object. This is the exact same access token that in the previous version of this library was able to get the files
object.
Making the same call using Postman (GET https://api.vimeo.com/videos/{video_id}
) and using the same access token for the Authorization
bearer token we get the Video data that contains the download
object and again no play
object. It does however contain the old files
data which we could use, although this is now no longer available in this SDK's Video
model.
As a temporary fix I'm considering doing a manual GET using retrofit (bypassing this library) and then first checking for the play
data (in case this becomes available in the future) and falling back to the old files
data (which may be removed in the future).
It would help if we could temporarily (re-)include the files
data in the Video
model.
I am having the same issues when auth with clientID and such. However, I have an access token with all the required access scopes and anytime I call to get the videoList via VimeoApiClient.instance().fetchVideoList( uri = uri, fieldFilter = null, queryParams = null, cacheControl = null, callback = vimeoCallback( onSuccess = { val asd = Results.Success(it.data) Log.d("Vimeo", "videoList Successful") }, onError = { vimeoError -> Log.d("Vimeo", "videoList UNNNNNsuccessful") } ) )
I get this ApiError(developerMessage=The operation could not be completed within the permitted time., errorMessage=We're like, soooo popular. Please try again in a few minutes., errorCode=1504, invalidParameters=null, link=null)
If we can get a FULL example of this working with the access token in the examples that would be great. Also, splitting up your readme into 2 different sections instead of having AccessToken or OtherWay may ease a lot of confusion.
Good luck trying to get Vimeo to care!
On Wed, 3 Nov 2021, 02:04 Randy Thedford, @.***> wrote:
I am having the same issues when auth with clientID and such. However, I have an access token with all the required access scopes and anytime I call to get the videoList via VimeoApiClient.instance().fetchVideoList( uri = uri, fieldFilter = null, queryParams = null, cacheControl = null, callback = vimeoCallback( onSuccess = { val asd = Results.Success(it.data) Log.d("Vimeo", "videoList Successful") }, onError = { vimeoError -> Log.d("Vimeo", "videoList UNNNNNsuccessful") } ) )
I get this ApiError(developerMessage=The operation could not be completed within the permitted time., errorMessage=We're like, soooo popular. Please try again in a few minutes., errorCode=1504, invalidParameters=null, link=null)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vimeo/vimeo-networking-java/issues/456#issuecomment-958675181, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPRWSR4363GUMNCATB5HX3UKDNHNANCNFSM4TDM6F4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Yeah, it seems that way. If the issue isn't resolved we will have no choice but to switch providers.
I switched to Mux - it's the only one I found that actually works and has a sensible pricing plan.
On Wed, 3 Nov 2021, 19:12 Randy Thedford, @.***> wrote:
Yeah, it seems that way. If the issue isn't resolved we will have no choice but to switch providers.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vimeo/vimeo-networking-java/issues/456#issuecomment-960310442, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPRWSV7CW7ONG756WBN7DTUKHMVNANCNFSM4TDM6F4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Thank you @charliepank I'll look into that. So far I created a very slim Vimeo Library in the last 2 days that allows me to pull the videos and play them with no issues. The only downside is Vimeo is so slow at delivering requests in the first place straight from their API. Does Mux have a good api and/or android/ios sdk?
If Mux API wasn't easy to use, I certainly would have failed with it!
On Sat, 6 Nov 2021, 15:08 Randy Thedford, @.***> wrote:
Thank you @charliepank https://github.com/charliepank I'll look into that. So far I created a very slim Vimeo Library in the last 2 days that allows me to pull the videos and play them with no issues. The only downside is Vimeo is so slow at delivering requests in the first place straight from their API. Does Mux have a good api and/or android/ios sdk?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vimeo/vimeo-networking-java/issues/456#issuecomment-962503512, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPRWSQ37RMB3CR4GK7YZETUKWKLLANCNFSM4TDM6F4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Update: I managed to get the play object and videos as expected with the following dependencies:
implementation "com.github.vimeo.vimeo-networking-java:vimeo-networking:2.0.10"
implementation "com.github.vimeo.vimeo-networking-java:models:2.0.10"
I have tried this on library version 3.12.0 & it works:-
val confBuilder = VimeoApiConfiguration.Builder(accessToken) val configuration = confBuilder.build() Authenticator.initialize(configuration) VimeoApiClient.initialize(configuration, Authenticator.instance())
VimeoApiClient.instance()
.fetchVideo(finalUrl, null, null, null, object : VimeoCallback<Video>{
//here url should be like ""https://api.vimeo.com/videos/{video_id}" otherwise it wasn't working whatever the url was
override fun onError(error: VimeoResponse.Error) {
Logger.d("TAG", "vimeo error = ${error.message}")
Toast.makeText(applicationContext, error.message, Toast.LENGTH_SHORT).show()
}
override fun onSuccess(response: VimeoResponse.Success<Video>) {
val video = response.data
Log.d("TAG", "vimeo video user = ${response.data.user?.name}")
val play: Play? = video.play
val progressiveFiles: List<ProgressiveVideoFile>? = play.progressive
val linkToMp4File: String? = progressiveFiles?.get(0)?.link
runExoplayer(linkToMp4File)
}
})
In this Play data will be there iff the video is created by the same user whose access token you are using.
You can verify this by comparing the user you are getting inside the video object (Logged above) with the user with which you have authenticated (shown below) :-
VimeoApiClient.instance().fetchCurrentUser(null, null, object : VimeoCallback<User>{
override fun onError(error: VimeoResponse.Error) {
}
override fun onSuccess(response: VimeoResponse.Success<User>) {
Logger.d("TAG", "vimeo user = ${response.data.name}")
}
})
Only those videos will have Play data whose user is same as video creator/member on vimeo account as your access token owner.
This is mentioned in the official document here https://developer.vimeo.com/api/authentication (Understanding the authentication process)