Coder Social home page Coder Social logo

vimeo-networking-java's Introduction

vimeo-networking

vimeo-networking is a JVM (Java & Kotlin) SDK used for interacting with the Vimeo API. The example app provided in this project shows the implementation in the context of an Android app.

WARNING: Please upgrade to version 3.x of this library by 3 March 2023 or manually disable certificate pinning on version 1.x or 2.x by this date. API requests that use certificate pinning will fail beginning on this date as the certificate that 1.x and 2.x pin to will expire and be replaced.

Branch Build Status
develop release workflow
Latest Version
JitPack

Contents

Prerequisites

In order to get started with using this library, there are a few prerequisites you need to satisfy, namely, creating a Vimeo account and registering an app with the API.

API Registration

In order to use this library and the Vimeo API, you will need an application registered with the Vimeo API. If you do not already have an application registered, you can do so here. If you do not have a Vimeo account, you will be prompted to sign up before registration.

After you have an application registered, you will have access to a few critical pieces of information required for initialization - the client identifier and client secret. These will both be located in the Authentication tab once you select your app from the list here.

More information about this and other API questions can be found on the API homepage.

Getting Started

For a more in depth look at the usage, refer to the example Android app. The example project includes implementations of client credential authentication, oauth authentication, and making simple requests.

Gradle

Make sure you include JitPack as a maven repository in your build.gradle file.

repositories {
  maven { url 'https://jitpack.io' }
}

Then add the following two dependencies to your build.gradle file.

implementation "com.github.vimeo.vimeo-networking-java:vimeo-networking:LATEST-VERSION"
implementation "com.github.vimeo.vimeo-networking-java:models:LATEST-VERSION"

See the CHANGELOG for the changes to each release.

Artifacts

There are several available artifacts for this SDK.

The core artifacts are

  • api-core - Contains general utilities, such as VimeoCallback.
  • auth - Contains the Authenticator and other authentication code.
  • request - Contains the VimeoApiClient and all request code.
  • models - Contains all the data transfer objects (DTOs) that are returned by the API.

One aggregate artifact exists as a convenience that bundles api-core, auth, and request

  • vimeo-networking - Includes all necessary modules except models.

Two alternative models artifacts exist

  • models-parcelable - Provides models that implement the Android Parcelable interface.
  • models-serializable - Provides models that implement the Java Serializable interface.

In order to use the SDK, you must always specify both vimeo-networking and one of models, models-parcelable, or models-serializable. Note that each models artifact is exclusive and cannot be used with another. You can only use one at a time. If you don't need Parcelable or Serializable, it's recommended to just use the default models.

JitPack

Generally, we recommend to use the latest release or alpha version that you can find in the releases tab. However, if you prefer to point to a specific commit, you can use JitPack to specify that commit:

implementation "com.github.vimeo.vimeo-networking-java:vimeo-networking:COMMIT_HASH"
implementation "com.github.vimeo.vimeo-networking-java:models:COMMIT_HASH"

Submodule

We recommend using JitPack, but if you'd like to use the library as a submodule, clone the repo:

git submodule add [email protected]:vimeo/vimeo-networking-java.git

Then in your build.gradle use:

implementation project(':vimeo-networking-java:vimeo-networking')
implementation project(':vimeo-networking-java:models')

Initialization

Access to the API is performed through the VimeoApiClient, which must be initialized prior to use. Consumers can choose to initialize a singleton instance or to create their own instance of the VimeoApiClient. In order to initialize the client, we need to construct an Authenticator, which is used to perform authentication requests and manage the SDK's authentication state. Like the VimeoApiClient, we can initialize a singleton instance or create a new instance of the Authenticator.

Initialization of the Authenticator is as follows:

// Create a new instance
val vimeoApiConfiguration = ...
val authenticator = Authenticator(vimeoApiConfiguration)

or

// Initialize the singleton
val vimeoApiConfiguration = ...
Authenticator.initialize(vimeoApiConfiguration)

Once we have the Authenticator initialized, we can proceed with initializing the VimeoApiClient as follows:

// Create a new instance
val vimeoApiConfiguration = ...
val authenticator = ...
val vimeoApiClient = VimeoApiClient(vimeoApiConfiguration, authenticator)

or

// Initialize the singleton
val vimeoApiConfiguration = ...
VimeoApiClient.initialize(vimeoApiConfiguration, Authenticator.instance())

The VimeoApiConfiguration is a customizable configuration that we use to provide the client identifier, client secret, and access scopes the SDK will use to communicate with the API. Constructing the VimeoApiConfiguration is done using the VimeoApiConfiguration.Builder that provides defaults for the other required configuration parameters.

In the below sections, we cover examples of ways to customize the VimeoApiClient instance. A full implementation can be found in the example app.

Configuration Tips for All Apps

We recommend the following for all apps when configuring the SDK with the VimeoApiConfiguration.Builder:

  • Provide a user agent to identify your app and the device using withUserAgent(String). By default the library creates its own user agent, but supplementing it with more info provides the Vimeo API with a better picture of what devices are accessing it. Not required, and we provide a default if none is provided.
  • Provide a cache directory with withCacheDirectory(File). By default the SDK does not set the cache directory and responses will not be cached, so you'll have to choose one to get the best performance.
  • Provide an AccountStore using withAccountStore(AccountStore). Unless you are accessing the API with a fixed access token, then you should probably provide a store that is disk backed. The default used by the SDK is an in-memory store that will not remember the logged in account after the app is restarted.

Configuration for Apps with Account Management

Create a VimeoApiConfiguration.Builder with your client identifier, client secret, and scope choices. After applying the above configuration tips, the configuration will be ready to use to initialize the Authenticator and VimeoApiClient.

And once initialization is complete, authenticate if necessary. This authentication can include client credentials or authentication via code grant.

Once authentication is complete, you can access the persisted VimeoAccount object through Authenticator.currentAccount.

Configuration Builder for Apps with Only One Developer Account

You can skip the need for client credentials or code grant requests if you provide an access token up front. 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. To do that, refer to the above section.

You can generate an access token in the Authentication tab once you select your app from the list here.

Once you have the access token, you can easily initialize your Authenticator and VimeoApiClient with the below configuration..

val accessToken: String = ... // Generate your access token on the API developer website
val vimeoApiConfiguration = VimeoApiConfiguration.Builder(accessToken)
  .build()

After providing the access token, if you'd like to have access to the associated User object you'll need to make a call to VimeoApiClient.fetchCurrentUser(...).

Note: You will not be able to log out of the account associated with the access token provided to the VimeoApiConfiguration.Builder or use any other authentication methods in the Authenticator. This is because we don't want anyone to accidentally invalidate/delete the token which is being used to authenticate users in a production application. You will still be able to delete the token via the web developer console.

Authentication

Note: This section does not apply if you configured the SDK with a pre-generated access token instead of client credentials.

All calls to the Vimeo API must be authenticated. This means that before making requests to the API you must authenticate and obtain an access token. Two authentication methods are provided:

  1. Client credentials grant: This mechanism allows your application to access publicly accessible content on Vimeo.

  2. OAuth authorization code grant: This mechanism allows a Vimeo user to grant permission to your app so that it can access private, user-specific content on their behalf.

Client Credentials Grant

val vimeoApiConfiguration: VimeoApiConfiguration = ...
val authenticator: Authenticator = Authenticator(vimeoApiConfiguration)
val vimeoApiClient: VimeoApiClient = VimeoApiClient(vimeoApiConfiguration, authenticator)

authenticator.authenticateWithClientCredentials(
  vimeoCallback(
    onSuccess = {
      // Can do something with the VimeoAccount, or ignore.
      // It will be automatically stored in the AccountStore.
      // The VimeoApiClient is now ready to make requests.
    },
    onError = {
      // Handle the error.
    }
  )
)

OAuth Authorization Code Grant

  1. Set up a redirect URL scheme. Choose a redirect URL for the Vimeo website to redirect to after the user logs in. For example, you could use something like https://example.com/redirect, where example.com is your domain. The default URL is vimeo://auth.

    The URL you use must be registered at https://developer.vimeo.com/apps. After that, you need to configure the SDK to use your URL by using the withCodeGrantRedirectUrl(String) function on the VimeoApiConfiguration.Builder.

  2. Open the authorization URL in the web browser:

// Create the URI to log in with some request code you can verify.
val loginUri = createCodeGrantAuthorizationUri(requestCode = "1234567")

// Open the URI in a browser (Android shown here).
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(loginUri))
startActivity(intent)
  1. The web browser will open and the user will be presented with a webpage asking them to grant access based on the scope that you specified in your VimeoApiClientConfiguration above.

  2. Add an intent filter to your activity in the AndroidManifest to listen for the deeplink.

<intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <!-- vimeo -->
  <data android:scheme="vimeo"/>
  <!-- auth -->
  <data android:host="auth"/>
</intent-filter>
  1. Then call Authenticator.authenticateWithCodeGrant(String, VimeoCallback) passing in the URL retrieved from val url = intent.data.toString() which will be supplied from the intent filter.

Note: You can find an example of both strategies in MainActivity.kt of the example app. You can also find more information on authentication in the authentication README or in the class documentation for Authenticator.

Requests

With the SDK configured and authenticated, you’re ready to start making requests to the Vimeo API.

Request Structure

Format

All requests functions are available on the VimeoApiClient and generally have the following common parameters:

  • uri: Used to specify which endpoint should be hit, required.
  • fieldFilter: An optional comma delimited list of the fields that you need from the API. See the API documentation on this for more information. While passing null is acceptable, limiting the data to what you need is strongly encouraged as it will reduce the response times.
  • queryParams: An optional map of key-value pairs that can be added to the query and further filter the response. See the API documentation on common parameters for more information.
  • cacheControl: The optional control that allows you to bypass the default caching behavior if you need to force a refresh or otherwise choose some different caching behavior for a specific request. Generally, leaving this null or providing CacheControl.FORCE_NETWORK are the only options we recommend using.
  • callback: The callback that will be invoked when the API response is received. It calls back on the callback thread provided by retrofit. For Kotlin consumers, a convenience function vimeoCallback can be used to construct an instance of the VimeoCallback class in a more idiomatic manner. For Java consumers, you'll have to rely on creating an instance of the VimeoCallback directly.

Requests start as soon as the function is invoked. All request functions return a VimeoRequest that can be used to cancel an in-flight request.

Validation

Most parameter validation is handled by retrofit and should be pretty lenient. For the uri parameter you will see in a lot request functions, the validation is slightly more strict. The uri cannot be empty, cannot be blank, and cannot contain a path traversal ... Otherwise the Vimeo API will validate your parameters and request.

Example Requests

Staff Picks

The below request will fetch the staff picks list.

val vimeoApiClient: VimeoApiClient = ...

vimeoApiClient.fetchVideoList(
  uri = STAFF_PICKS_VIDEO_URI,
  fieldFilter = null,
  queryParams = null,
  cacheControl = null,
  callback = vimeoCallback(
    onSuccess = {
      val videoList = it.data
      println("Staff Picks Success!")
    },
    onError = {
      println("Staff Picks Failure: ${it.message}")
    }
  )
)

Currently Authenticated User

val vimeoApiClient: VimeoApiClient = ...

vimeoApiClient.fetchCurrentUser(
  fieldFilter = null,
  cacheControl = null,
  callback = vimeoCallback(
    onSuccess = {
      // Update the UI with information about the current user
    },
    onError = {
      // Log the error and update the UI to tell the user there was an error
    }
  )
)

FAQs

How do I get a video that I own?

You can either request a Video object on its own or request a list of videos (VideoList).

Requesting a single video

To request a single video, you will need to know its URI. For this reason, requesting a single video is most helpful when you already have a copy of it and just need to refresh your local copy with the copy that exists on the Vimeo servers.

val uri = ...  // the video uri
val vimeoApiClient = ...

vimeoApiClient.fetchVideo(
  uri = uri,
  fieldFilter = null,
  queryParams = null,
  cacheControl = null,
  callback = vimeoCallback(
    onSuccess = {
      // Use the video.
    },
    onError = {
      // Voice the error.
    }
  )
) 

Requesting a list of videos

In order to get a list of your own videos you will need a URI from one of two ways:

As the authenticated user, just use the /me/videos endpoint:

val uri = "/me/videos" 

In the second approach, you must have a reference to your User object. You can get a list of videos a users owns as follows:

val user = ... // Get a reference to the User object
val uri = user.metadata?.connections?.videos?.uri

Then you can use the URI to get a list of videos

val uri = ... // Obtained using one of the above methods
val vimeoApiClient = ...

vimeoApiClient.fetchVideoList(
  uri = uri,
  fieldFilters = null,
  queryParams = null,
  cacheControl = null,
  callback = vimeoCallback(
    onSuccess = {
      // Getting the first video in the list.
      val firstVideo = it.data.data?.firstOrNull()
    },
    onError = {
      // Voice the error.
    }
  )
)

How do I play a video?

Once you have a Video object you have two choices - embed or play natively. All consumers of this library will be able to access the embed data. However, in order to play videos natively (for example, in a VideoView or using ExoPlayer on Android) you must have access to the VideoFile links, for which there are some restrictions (see the native playback section below).

Embed

All consumers of this library will have access to a video's embed HTML. Once you request a video you can get access to this as such:

val video = ... // Obtain a video as described in the requests section
val html: String? = video.embed?.html

// html is in the form "<iframe .... ></iframe>"
// display the html however you wish

Note: Android WebView is not officially supported by our embeddable player.

Native playback

The basic requirements for native playback are:

  1. User must be logged in.
  2. User must be the owner of the video.
  3. User must be PRO or higher (or the app must have the "can access owner's video files" capability).
  4. Token must have the ScopeType.VIDEO_FILES scope.
  5. User must be the owner of the API app making the request.

If you satisfy all of the requirements, you can choose to stream the videos in any manner you wish. You can get access to DASH or HLS video files through a video's Play representation.

val video = ... // Obtain a video you own as described above
val dashLink: String? = video.play?.dash?.link
val hlsLink: String? = video.play?.hls?.link

// Use one of the links to play

Found an Issue?

Please file it in the git issue tracker.

Want to Contribute?

If you'd like to contribute, please follow our guidelines found in CONTRIBUTING.md.

License

vimeo-networking-java is available under the MIT license. See the LICENSE file for more info.

Questions?

Tweet at us here: @VimeoEng.

Post on Stackoverflow with the tag vimeo-android.

Get in touch here.

Interested in working at Vimeo? We're hiring!

vimeo-networking-java's People

Contributors

abalcer-ls avatar alex-faraday avatar alfiehanssen avatar anthonycr avatar brentwatson avatar dependabot[bot] avatar elhicks avatar estepiuk avatar harish-veeramani avatar howardrigberg avatar ievgenii-vimeo avatar kevinzetterstrom avatar kvenn avatar kyrylo-shadrintsev avatar maksym-ambroskin avatar mathiasgr avatar mikew-personal avatar mrthegood avatar msya avatar romanminenok avatar shanestaples avatar valerian87 avatar vbevans94 avatar whosnickdoglio avatar wilrnh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vimeo-networking-java's Issues

VimeoError on fetchContent() request with incorrect system date on device on Android Oreo

Issue Summary

When I tried to make fetchContent() request with incorrect system date, I got the com.vimeo.networking.model.error.VimeoError, Chain validation failed. It reproduces on android Oreo. For previous versions vimeo sdk works correct.

The same behavior I see in Vimeo android app.

Sdk version : vimeo-networking:1.1.1.

Reproduction Steps

Device:all
OS: Android oreo
Steps:

  1. Go to device setting and set future date (next week or mounth).
  2. Make any api call to vimeo using vimeo sdk.
  3. Receive the error.

Expected Behavior

API should work without errors as on previous android versions.

Actual Behavior

I got the error VimeoError with message "Chain validation failed"
com.vimeo.networking.model.error.VimeoError
at com.vimeo.networking.callbacks.VimeoCallback.onFailure(VimeoCallback.java:86)
at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$2.run(ExecutorCallAdapterFactory.java:77)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:172)
at android.app.ActivityThread.main(ActivityThread.java:6637)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Development branch as main branch

Issue Summary

The development branch is currently the main branch, meaning that the documentation most people will see is ahead of the current version.

This causes problems like this one (I actually had the same problem when trying to get video files)

Expected Behavior

That the documentation shown in the README.md is the documentation of the current version of vimeo-networking-java

Actual Behavior

README.md shows documentation for a next version, which can cause headaches for users of the library.

playback issue on S4

Issue Summary

The video does not render correctly on the S4, only towards the end

it's ok with the vimeo app

So what's the trick?

class path not found intergratrating vimeo

Issue Summary

:"Warning:[options] bootstrap class path not set in conjunction with -source 1.7"e.

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?

video.getPlay() returns null

Issue Summary

As docs suggesting, i'm trying to get the Play object using: Play play = video.getPlay(); but this always returns null...

Any suggestions?

I've followed the docs correctly and i'm using a token auth..

Thanks

Upgrade com.intellij:annotations to avoid Dex Compiler D8 conflict issues

Issue Summary

The dependency com.intellij:annotations has been moved to a new group org.jetbrains as noticed here but has kept the same package names for its classes. This is causing conflict with the new Dex Compiler (D8) and newer versions of libraries like org.jetbrains.kotlin:kotlin-stdlib-jre7 which depends on the newer org.jetbrains:annotations.

Reproduction Steps

  • With Android Studio 3.2 Canary 1, create a simple (Empty Activity) Android project with Kotlin support
  • Add app dependency: com.vimeo.networking:vimeo-networking:1.1.0
  • Run: ./gradlew assembleDebug

Expected Behavior

No conflict issues.

Actual Behavior

Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: org.intellij.lang.annotations.JdkConstants$PatternFlags

Workaround

Exclude vimeo-networking dependency on com.intellij:annotations

implementation("com.vimeo.networking:vimeo-networking:$vimeoNetworkingVersion", {
        exclude group: "com.intellij", module: "annotations"
    })

'void com.vimeo.networking.GsonDeserializer.deserialize

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.vimeo.networking.GsonDeserializer.deserialize(com.google.gson.Gson, java.lang.Object, com.vimeo.networking.callbacks.ModelCallback)' on a null object reference
        at com.vimeo.networking.VimeoClient$5.success(VimeoClient.java:1169)
        at com.vimeo.networking.callbacks.VimeoCallback.onResponse(VimeoCallback.java:55)
        at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:70)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:201)
        at android.app.ActivityThread.main(ActivityThread.java:6810)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
var configBuilder = Configuration.Builder(VimeoHelper.clientId, VimeoHelper.clientSecret, VimeoHelper.SCOPE)
    .setCacheDirectory(activity?.getCacheDir())


VimeoClient.initialize(configBuilder.build());
VimeoClient.getInstance().authorizeWithClientCredentialsGrant(object : AuthCallback {
    override fun success() {
        vimeoClient = VimeoClient.getInstance();
        playVideo();
    }

    override fun failure(error: VimeoError?) {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }
})


vimeoClient ?.fetchNetworkContent("/videos/354539932", object : ModelCallback<VideoList>(com.vimeo.networking.model.VideoList::class.java) {
    override fun success(video: com.vimeo.networking.model.VideoList?) {
        Helper.setLog(TAG,"success")
    }

    override fun failure(error: VimeoError) {
        Helper.setLog(TAG,"failure"+error.developerMessage)
    }
})

Set Thumbnails to Android ImageView

Issue Summary

I am trying to set thumbnails for my Vimeo videos to my Android ImageView. How do I set com.vimeo.networking.model.Picture to Android ImageView?

Reproduction Steps

mVimeoClient.fetchNetworkContent(VIDEO_URI, new ModelCallback<VideoList>(VideoList.class) {
           @Override
           public void success(VideoList videoList) {
                ArrayList<Video> videoArrayList = videoList.data;
               Video video = videoArrayList.get(0);
               ArrayList<Pictures> arrayListPics = video.pictures.sizes;
               imageView.setImageBitmap( (Bitmap) arrayListPics.get(0));
           }
           @Override
           public void failure(VimeoError error) {
           }
        });
}

Expected Behavior

Set com.vimeo.networking.model.Picture to Android ImageView

Actual Behavior

java.lang.ClassCastException: com.vimeo.networking.model.Picture cannot be cast to android.graphics.Bitmap

java.lang.ClassCastException: com.vimeo.networking.model.Picture cannot be cast to android.graphics.drawable.Drawable

get build error after I includ this module to my project

Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.

java.io.IOException: Can't write [/Users/ives/android/bm/app/build/intermediates/multi-dex/debug/componentClasses.jar] (Can't read [/Applications/Android Studio.app/Contents/gradle/m2repository/org/jetbrains/annotations/13.0/annotations-13.0.jar(;;;;;;**.class)] (Duplicate zip entry [annotations-13.0.jar:org/intellij/lang/annotations/Identifier.class]))

I get the error message, so I can't use this api.

my build.gradle(app) is as follow

`apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
signingConfigs {
config {
keyAlias 'bm'
keyPassword 'K5SD23r6'
storeFile file('/Users/ivessun/android/bm/bm.jks')
storePassword 'K5SD23r6'
}
}
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.sportpassword.bm"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.config
    }
}

}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "com.android.support:appcompat-v7:$design_version"
implementation "com.android.support:design:$design_version"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "com.android.support:support-v4:$design_version"
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile "com.android.support:appcompat-v7:$design_version"
compile "com.android.support:design:$design_version"
compile "com.android.support:recyclerview-v7:$design_version"
compile "com.android.support:cardview-v7:$design_version"
compile 'com.android.volley:volley:1.1.0'
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "org.jetbrains.anko:anko:$anko_version"
compile 'com.squareup.picasso:picasso:2.5.2'
compile project(':vimeo-networking')
}
`

my build.gradle(bm)

`
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.21'
ext.anko_version = '0.10.4'
ext.design_version = '27.1.0'
repositories {
google()
jcenter()
mavenCentral()
maven{url 'https://jitpack.io'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects {
repositories {
google()
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
`
can you resolve this problem?
Thanks.

How to play a private video?

Issue Summary

I want to upload videos on vimeo, that should be play only from my android app, using this library

Reproduction Steps

To achieve this:

  1. I uploaded private video (uploaded with the privacy option 'Only I can see this video' ) on vimeo.
  2. After configuration call the method fetchMyVideo("xxxxxxx");
private void fetchMyVideo(String id) {
VimeoClient.getInstance().fetchNetworkContent("/videos/"+id, new ModelCallback<Video>(Video.class) {
     @Override
     public void success(Video video) {
          String html = video.mEmbed != null ? video.mEmbed.getHtml() : null;
          // VimeoActivity.class have a webview to load this html
          Intent mIntent = new Intent(this, VimeoActivity.class);
          mIntent.putExtra("html", html);
          startActivity(mIntent);
     }
     @Override
     public void failure(VimeoError error) {
     }
});
}
  1. But WebView showing message "Private video, Login to watch...." ?

Expected Behavior

Private video should play using this library with provided access token.

Actual Behavior

Video is not playing and WebView showing message "Private video, Login to watch..." ?

Library is not syncing in android studio

I have tried to use this Library as a gradle dependency.. but its showing above issue.

But I have tried using 1.1.2 its sync successfully. I am trying to run the example project..
I need help..

Thanks
DIVYA PRAKASH

Progress Bar is not displayed in the webview

Issue Summary

When loading video in the webview, i am able to see the progress/seek bar for the first time, but after the progress/seek bar is hidden,onclicking of the webview it isn't displayed again

Reproduction Steps

Load video in the Webview and click on the screen

Expected Behavior

The progress/seek bar to be displayed/hidden

Actual Behavior

Nothing

getting MalformedJsonException

I'm integrating the sdk in my android aplication using a fixed acess token (generated through the website).

This is my code to initialize the vimeoclient

`Configuration.Builder configBuilder;

public void initVimeo(){
    configBuilder = getAccessTokenBuilder();
    VimeoClient.initialize(configBuilder.build());

}

public Configuration.Builder getAccessTokenBuilder() {
    // The values file is left out of git, so you'll have to provide your own access token
    String accessToken = Constants.VIMEO_ACESS_TOKEN;
    return new Configuration.Builder(accessToken);
}`

This is how I'm fetching the video:

`String url = "https://vimeo.com/106381957";

    VimeoClient.getInstance().fetchContent(url, CacheControl.FORCE_NETWORK, new ModelCallback<Video>(Video.class) {
        @Override
        public void success(Video video) {
            if (video != null) {
                Log.d("VIMEO RESULT: ", video.embed.html);

                //Auto playing vimeo videos in Android webview
                mWebView.getSettings().setJavaScriptEnabled(true);
                mWebView.getSettings().setAllowFileAccess(true);
                mWebView.getSettings().setAppCacheEnabled(true);
                mWebView.getSettings().setDomStorageEnabled(true);
                mWebView.getSettings().setPluginState(PluginState.OFF);
                mWebView.getSettings().setAllowFileAccess(true);

                String mime = "text/html";
                String encoding = "utf-8";
                mWebView.loadDataWithBaseURL(null, video.embed.html, mime, encoding, null);

                setContentView(mWebView.getLayout());

                //Esconder a Status Bar
                View decorView = getWindow().getDecorView();
                // Hide the status bar.
                int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
                decorView.setSystemUiVisibility(uiOptions);
                // Remember that you should never show the action bar if the
                // status bar is hidden, so hide that too if necessary.
                ActionBar actionBar = getActionBar();
                if(actionBar!=null) {
                    actionBar.hide();
                }

            }
        }

        @Override
        public void failure(VimeoError error) {
            String errorMessage = error.getDeveloperMessage();
            Log.d("VIMEO RESULT: ", errorMessage);
        }
    });`

However I'm getting a error response as follows:

Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $

ported to retrofit2 2.1.0 and support annotations...want me to upload?

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?

JsonSyntaxException: Expected a string but was BEGIN_OBJECT at line 1 column 2 path $

Issue Summary

I want to know the link of a Video ID that I have in the database but an error occurs when deserializing the object.

I'm using the latest stable version (implementation "com.vimeo.networking:vimeo-networking:1.1.3"). It's an Android project with Kotlin.

Reproduction Steps

Just try to fetch the content of a Video like:

VimeoClient.getInstance().fetchNetworkContent("/videos/"+id, object : ModelCallback<Video>(Video::class.java) {

    override fun success(video: Video) {
        onSuccess(video, videoInfo, directory, fetch)
    }

    override fun failure(error: VimeoError) {
        Timber.e(error.exception,"Vimeo download error occurred ${error.developerMessage}")
    }

})

Expected Behavior

A deserialized Video object where I can use it and access the video link.

Actual Behavior

A com.google.gson.JsonSyntaxException exception occurs:

I/System.out: --------- RESPONSE ---------
I/System.out: ENDPOINT: /videos/<redacted>
    STATUS CODE: 200
I/System.out: REQUEST TIME: 1322.8ms
I/System.out: --------- RESPONSE END ---------
I/System.out: Error when deserializing object!
W/System.err: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 2 path $
        at com.google.gson.Gson.fromJson(Gson.java:900)
W/System.err:     at com.google.gson.Gson.fromJson(Gson.java:853)
        at com.google.gson.Gson.fromJson(Gson.java:802)
        at com.google.gson.Gson.fromJson(Gson.java:774)
        at com.vimeo.networking.GsonDeserializer.deserializeObject(GsonDeserializer.java:66)
        at com.vimeo.networking.GsonDeserializer.deserialize(GsonDeserializer.java:58)
        at com.vimeo.networking.VimeoClient$5.success(VimeoClient.java:1169)
        at com.vimeo.networking.callbacks.VimeoCallback.onResponse(VimeoCallback.java:55)
        at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:70)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6762)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
    Caused by: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 2 path $
        at com.google.gson.stream.JsonReader.nextString(JsonReader.java:825)
        at com.google.gson.internal.bind.TypeAdapters$EnumTypeAdapter.read(TypeAdapters.java:799)
        at com.google.gson.internal.bind.TypeAdapters$EnumTypeAdapter.read(TypeAdapters.java:772)

From the stack trace you can see it fails in

return gson.fromJson(JSON, callback.getObjectType());
.

about api versioning and deprecated properties

Issue Summary

I am worry about deprecated properties.
I know already created and closed issue about this topic. (#188 )

However, I cannot use Video.play property. It's just throws me NullPointerException.
So that I inevitably use this deprecated properties.

I don't want NullPointerException when api updated.
So I wrote the following code

private void initVimeo() {
    Configuration.Builder builder = new Configuration.Builder(Constants.Vimeo.ACCESS_TOKEN.getValue())
            .setApiVersionString("3.2");
    VimeoClient.initialize(builder.build());
}

Is this right way? and what is best practice?

Reproduction Steps

N/A

Expected Behavior

N/A

Actual Behavior

N/A

Create example java application using vimeo-networking-java

Issue Summary

Currently only an Android example of the library exists. It'd be great to see a java project consume vimeo-networking-java. Feedback from this SO post.

Additionally, it would be great to include an example of how to upload with this library.

Reproduction Steps

N/A

Expected Behavior

N/A

Actual Behavior

N/A

Can you not use the Retrofit library?

Correct me if I am wrong.
If I include this library, then I have to use the Retrofit library version that you are using.
I know you guys are keep updating your library to use the latest Retrofit library version. However, until you release a new build, I am stuck with the older version of the Retrofit library.

Our company makes libraries(SDK) for our clients and if we include your library to our library(SDK), then our clients are stuck with the Retrofit version which you are using too.

Whenever the Retrofit library upgrade is 100% backwards compatible with the older version, then I could replace with the newer version. However, it is not the case all the time, right?

The library should be able to support the handling of multiple access tokens

Issue Summary

As of right now, vimeo-networking-java holds a singleton VimeoClient which can only hold one access token. In a single-user application this makes sense, but for a Java web server handling multiple users, a singleton won't work.
Find a way to allow for multiple access tokens in the context of a multi-user Java implementation.

Reproduction Steps

N/A

Expected Behavior

The VimeoClient singleton either isn't a singleton or houses support for managing multiple requests from multiple accesstokens.

Actual Behavior

You can only ever have one currently authenticated user at a time.

Force cache invalidation on API version change

Issue Summary

When the API version changes, the cache is not cleared. This creates a potential for serialization crashes due to changes in object representations.

Suggested Improvements

Since the API version is no longer exposed to the library consumer, we should invalidate the retrofit cache when we detect an API version change internally. This will require us to persist the current version of the API to disk. We should do this either using a flat file (since this is a java library) or force the consumer to provide an implementation of an interface that writes and retrieves key value pairs to disk.

interface KeyValueStorage {
    fun storeStringForKey(key: String, value: String?)

    fun retrieveStringForKey(key: String): String?
}

Then we will force cache invalidation any time we detect a change in the API Version.

APplication crash issue

using same code as examples but still getting error on app start

FATAL EXCEPTION: main
Process: com.sample.vimeosdkapplication, PID: 2113
java.lang.AssertionError: Instance must be configured before use
at com.vimeo.networking.VimeoClient.getInstance(VimeoClient.java:94)
at com.sample.vimeosdkapplication.MainActivity.(MainActivity.java:28)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1572)
at android.app.Instrumentation.newActivity(Instrumentation.java:1065)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2199)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
07-22 16:56:57.000 2113-2120/com.sample.vimeosdkapplication W/art: Suspending all threads took: 10ms

Embedded video stop at the last frame showing an infinite loader

Issue Summary

After receiving the i-frame of a public account video, we extract the link of the video and load it inside a WebView. Everything seems to work correctly except for 1 case:

  • on a 6.0.0 Android device, some videos stop on the last frame showing an infinite loader.

This is actually happening only on some videos of the channel, we got 1 video working fine.

Reproduction Steps

We actually can't help reproducing the problem, as we're facing it only on one particular device with Android 6.0.0.
We checked the web(s) versions, here's the detail:

  • Mozilla/5.0 (Linux; Android 6.0; Poynt-P61B Build/MRA58K; WV) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/44.0.2403.119 Safari/537.36

On the same device, with a different Android version (4.4.4) with these versions every video of the channel works fine:

  • Mozilla/5.0 (Linux; Android 4.4.4; Poynt-P61 Build/KTU84Q) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Safari/537.36

Conclusion

Did anyone else encounter this problem? Is there any solution to it?

ssl: CertPath ValidatorException

Issue Summary

When playing some videos on some devices, it shows CertPath ValidatorException.
Trust anchor not found.

Expected Behavior

Should play videos normally as it is working on many devices but giving ssl exception on some devices.

Actual Behavior

SSL error.

You can give an option for customizing the okhttp client used in library.

Calling fetchNetworkContent throws no such instance error

In my app, I want to show my private videos to user whosoever downloads the android application. As per the documentation, I have initialized VimeoClient with accessToken (taken from web interface http://developer.vimeo.com/apps). After initializing the VimeoClient (not making any object reference), I have called the fetchNetworkContent method. However, it's showing 'No VimeoClient instance'. Please help me out.

Points to be taken care of:

  1. I have tried using a variable of VimeoClient and then calling VimeoClient.getInstance() method to it. But it again returns error. No such instance of VimeoClient.
  2. I have even tried initializing the VimeoClient first with configuration (setting access token, client ID, client secret, redirect uri) and after that calling VimeoClient.getInstance() still no luck.
  3. Even tried using only ClientID and Client Secret in configuration and then calling authorizeWithClientCredentials. I am able to login, it shows success message however, whenever, I am calling fetchNetworkContent method here, I am getting the 'No such instance of VimeoClient' again here.

implementation "com.vimeo.networking:vimeo-networking:1.1.3"

I have tried to use this Library as a gradle dependency.. but its showing above issue.

But i have tried using 1.1.2 its sync successfully. I am trying to run the example project.. but
Configuration.Builder configBuilder =
new Configuration.Builder(clientId, clientSecret, SCOPE, testAccountStore);

here in last parameter it requires String parameter. I need help..

Thanks

How to get HLS/DASH video file?

Issue Summary

Hi, I am a PRO user and I'd like to use HLS or DASH (adaptive strategy). However, at my video.getDownload(), only mp4files are available, and since the current version 1.x doesn't support getPlay() yet, I cannot use getDashVideoFile() or similar.

Reproduction Steps

VimeoClient.getInstance().fetchNetworkContent("/videos/" + videoId, new ModelCallback<Video>(Video.class) {
    @Override
    public void success(Video video) {
        ArrayList<VideoFile> videoFiles = video.getDownload();
        // this array doesn't have any HLS or DASH VideoFile
    }
}

Am I doing something wrong? Isn't every video intended to have this option?

Problem with proguard and GsonDeserializer class

I tried to implement the library in conjunction with proGuard.
I copied the GsonDeserializer.class from the example and handed it to the Configuration.Builder class.
When proGuard is off, everything is working perfect. When ProGuard is on, the app crashed with the following log:

Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by java.lang.AssertionError: java.lang.NoSuchFieldException: NOBODY
at com.google.gson.internal.bind.TypeAdapters$EnumTypeAdapter.(SourceFile)
at com.google.gson.internal.bind.TypeAdapters$30.create(SourceFile:834)
at com.google.gson.Gson.getAdapter(SourceFile:423)
at com.google.gson.Gson.getAdapter(SourceFile:521)
at com.vimeo.stag.generated.Stag.readFromAdapter(SourceFile:69)
at com.vimeo.stag.generated.ParseUtils.parsePrivacy(SourceFile:4757)
at com.vimeo.stag.generated.ParseUtils.parseVideo(SourceFile:1991)
at com.vimeo.stag.generated.Stag$VideoAdapter.read(SourceFile:807)
at com.vimeo.stag.generated.Stag$VideoAdapter.read(SourceFile:793)
at com.vimeo.stag.generated.Stag.readListFromAdapter(SourceFile:85)
at com.vimeo.stag.generated.ParseUtils.parseArray(SourceFile:67)
at com.vimeo.stag.generated.ParseUtils.parseVideoList(SourceFile:4838)
at com.vimeo.stag.generated.Stag$VideoListAdapter.read(SourceFile:537)
at com.vimeo.stag.generated.Stag$VideoListAdapter.read(SourceFile:523)
at com.google.gson.Gson.fromJson(SourceFile:887)
at com.google.gson.Gson.fromJson(SourceFile:852)
at com.google.gson.Gson.fromJson(SourceFile:801)
at com.google.gson.Gson.fromJson(SourceFile:773)

I tried to add this lines to proGuard rules:
`-keep class com.ysapps.videoplayer.AndroidGsonDeserializer

-keepclassmembers class * implements com.vimeo.networking.GsonDeserializer {
;
}

-keepnames class * implements com.vimeo.networking.GsonDeserializer`

But it not solved the issue.

Getting null from video.getPlay()

I successfully get a Video instance from fetchNetworkContent but then I get null when invoking video.getPlay().

String accessToken = getString(R.string.vimeo_access_token);
Configuration.Builder configBuilder = new Configuration.Builder(accessToken);
VimeoClient.initialize(configBuilder.build());

VimeoClient.getInstance().fetchNetworkContent(uri, new ModelCallback<Video>(Video.class) {
    @Override
    public void success(Video video) {
        // I successfully get here , but play is null.
        Play play = video.getPlay();
        if (play != null) {
            VideoFile hlsFile = play.getHlsVideoFile();
            String hlsLink = hlsFile.getLink();
            initializePlayer(Uri.parse(hlsLink));
        }
    }

    @Override
    public void failure(VimeoError error) {
        ...
    }
});

I am using a token which I created from My Apps with my Vimeo Account.
I am expecting to get some result from play so I can get the hls link of the video.

I am following all the requesites the documentation ask to get video files.

  1. User must be logged in. (I am using a valid token which I create in my app)
  2. User must be the owner of the video. (I am the owner of the video I am asking for)
  3. User must be PRO or higher (or the app must have the "can access owner's video files" capability). (My account is PRO, I can even get this link from vimeo playground)
  4. Token must have the video_files scope. (My token has the video_files scope, actually I tried with all the scopes on but did not work)
  5. User must be the owner of the API app making the request. (The app is mine that I created using the same account)

Trying for two days, how to solve this issue?

Verify model parsing using PODAM library

Summary

We should create functional tests which verify the correctness of our models and the parsing logic we use as a part of this library. We can do that by leveraging the PODAM library to generate POJOs filled with random data. We will then use this to test the JSON parsing logic we have in place.

An example can be seen in tests for the stag library here.

How to import use this library on my Java project ?

Issue Summary

I would like to use this library to make requests on Vimeo API.

Reproduction Steps

Create a project Java project on Intellij, import this library, vimeo-netoworking-java and be able to found its classes/packages.

Expected Behavior

Find the classes and packages after the library has been imported.

Actual Behavior

Can't find the classes/packages on my application.

Please, I need help! For more information visit here.

Version 1.0.1 broken when using retrofit2 release version

As the 1.0.1 version uses the retrofit2-beta3 build, it will not work when using the retrofit2 release version (currently 2.1.0) as there have been changes to the converter package name.
It will fail when intializing the VimeoClient with a NoClassDefFoundError:
FATAL EXCEPTION: main Process: de.meinestadt.talenthero, PID: 29389 java.lang.NoClassDefFoundError: Failed resolution of: Lretrofit2/GsonConverterFactory; at com.vimeo.networking.VimeoClient.createRetrofit(VimeoClient.java:120) at com.vimeo.networking.VimeoClient.<init>(VimeoClient.java:112) at com.vimeo.networking.VimeoClient.initialize(VimeoClient.java:101) at de.meinestadt.talenthero.TalentHeroApp.onCreate(TalentHeroApp.java:35) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707) at android.app.ActivityThread.-wrap1(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: java.lang.ClassNotFoundException: Didn't find class "retrofit2.GsonConverterFactory" on path: DexPathList[[zip file "/data/app/de.meinestadt.talenthero-2/base.apk"],nativeLibraryDirectories=[/data/app/de.meinestadt.talenthero-2/lib/arm, /data/app/de.meinestadt.talenthero-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at com.vimeo.networking.VimeoClient.createRetrofit(VimeoClient.java:120)  at com.vimeo.networking.VimeoClient.<init>(VimeoClient.java:112)  at com.vimeo.networking.VimeoClient.initialize(VimeoClient.java:101)  at de.meinestadt.talenthero.TalentHeroApp.onCreate(TalentHeroApp.java:35)  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)  at android.app.ActivityThread.-wrap1(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5417)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  Suppressed: java.lang.ClassNotFoundException: retrofit2.GsonConverterFactory at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 15 more

Looking into the source, it seems the package name of the GsonConverterFactory changed from 'retrofit2' to 'retrofit2.converter.gson' and therfore it will throw an exception when trying to intialize.

On the 1.1.0 branch, it seems to be fixed, as the retrofit2 release version was used, when is it going to be released?

Not able to access private videos

I have configured the Vimeoclient using the below code:

Configuration.Builder configBuilder = new Configuration.Builder(getString(R.string.vimeo_client_id),getString(R.string.vimeo_client_secret), "private public video_files").setCacheDirectory(this.getCacheDir()).setGsonDeserializer(new GsonDeserializer());

After initializing the vimeoclient, I am trying to access private videos(PRO member) using fetchNetworkContent but it always returns an error: The requested video could not be found.

Please help in resolving this.

How to get other user's private video?

Issue Summary

I am having pro account, and I am fetching my own video's but I need to fetch other user's private video's. How this is possible. If they shared accessToken with me is this possible? Or any otherway please provide.

Reproduction Steps

Is there any way to get other user's private video?

Expected Behavior

I have an user's video id which is his private video. And I am having pro account but I tried to fetch video object of other user is not able to fetch. I am getting below error

STATUS CODE: 404

But I can fetch my private video's successfully.
with following code.

String videoUri = "/videos/" + videoId;
        mApiClient.fetchNetworkContent(videoUri, new ModelCallback<Video>(Video.class) {
            @Override
            public void success(Video video) {
                videoName = video.name;
                Log.d("VideoName ::", video.name + " Te");
                playVideo(video);
            }

            @Override
            public void failure(VimeoError error) {
                Toast.makeText(MediaActivity.this, MediaActivity.this.getString(R.string.something_went_wrong), Toast.LENGTH_SHORT).show();
                Log.e("VimeoError : ", error.toString());
            }
        });

Actual Behavior

Can you provide any other way's to access other user video's. Is there access token is needed for that user to access vimeo network library.

Picture#link_with_play_button does not exist

Issue Summary

In the Picture class in v1.1.0 and on the develop branch there is a link field / getLink method which corresponds to the link field in the API response. But in the API response there is also a link_with_play_button field:

screen shot 2018-04-10 at 1 09 14 pm

It would be useful if this field was present in the Picture class so one could use it. (It would be especially useful if this was present in 1.1.x / 1.x.x versions)

Reproduction Steps

N/A

Expected Behavior

Expected ability to get linkWithPlayButton from Picture element

Actual Behavior

linkWithPlayButton field / getter does not exist

What's is the current version?

Sorry for the simple question, but last time I had a problem with versions.
What's the current version of the api? Which branch should I use now?

I was getting the Hls link using the code below:

ArrayList<VideoFile> videoFiles = video.files;
                if (videoFiles != null && !videoFiles.isEmpty()) {
                    // We are getting the last hlsLink, which is the HlsLink.
                    VideoFile videoFile = videoFiles.get(videoFiles.size() - 1);
                    String hlsLink = videoFile.getLink();
                    videoUri = Uri.parse(hlsLink);
                    initializePlayer(videoUri);
                }

video.files is deprecated, but in the other issue they told me I could still use it. Because it hasn't changed at. Should I keep getting the Hls link like that or can I update to the new way below?

Video video = ...; // obtain a video you own as described above
Play play = video.getPlay();
if (play != null) {
     VideoFile dashFile = play.getDashVideoFile();
     String dashLike = dashFile.getLink();
     // load link
     
     VideoFile hlsFile = play.getHlsVideoFile();
     String hlsLink = hlsFile.getLink();
     // load link
     
     ArrayList<VideoFile> progressiveFiles = play.getProgressiveVideoFiles();
     // pick a progressive file to play
}

How to upload video to Vimeo from Android app using this Library?

Hello.

I would like to upload video to vimeo from my android app.
Can I upload video from my android app using your github repository?
Or is there any other published github source code that can upload video?

Thanks,
Look forward to hearing from you.

Best Regards.

Providing a user agent with a ™️ character in it causes crash

Issue Summary

Passing certain characters as the user agent to the networking library causes a crash. The crash is internally caused by (https://github.com/square/okhttp/blob/parent-3.9.1/okhttp/src/main/java/okhttp3/Headers.java#L324).

Reproduction Steps

Pass a non ascii character as the user agent, e.g. ™️. Then make a network request and observe the crash.

Expected Behavior

I would expect either the crash not to occur OR the setUserAgentString to throw an exception if the user agent is not valid.

Actual Behavior

java.lang.IllegalArgumentException: Unexpected char 0x2122 at 62 in User-Agent value: com.vimeo.android.videoapp (Trapress.net/MYTPRO Dev., Trapress™ MYTab, google, Android 4.4.2/19 Version 2.17.0) VimeoNetworking/2.0.0-alpha.4 (Java)
	at okhttp3.Headers$Builder.checkNameAndValue(Headers.java:320)
	at okhttp3.Headers$Builder.set(Headers.java:300)
	at okhttp3.Request$Builder.header(Request.java:164)
	at com.vimeo.networking.interceptors.UserAgentInterceptor.intercept(UserAgentInterceptor.java:52)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
	at com.vimeo.networking.logging.LoggingInterceptor.intercept(LoggingInterceptor.java:76)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:179)
	at okhttp3.RealCall$AsyncCall.execute(RealCall.java:129)
	at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)

Getting javax.net.ssl.SSLProtocolException Error

Issue Summary

javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x654f7030: Failure in SSL library, usually a protocol error
error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version (external/openssl/ssl/s23_clnt.c:741 0x5d6becfc:0x00000000)

I'm using this code to get video lists
VimeoClient.getInstance().fetchNetworkContent(STAFF_PICKS_VIDEO_URI, new ModelCallback(VideoList.class) {
@OverRide
public void success(VideoList videoList) {

        }

        @Override
        public void failure(VimeoError error) {
            Log.e("vimeo error", error.getDeveloperMessage());
        }
    });

I'm testing it on tablet Android 4.4.4 API19

Native playback Video.files Deprecated

Issue Summary

In native playback the docs specify to use:

Video video = ...; // obtain a video you own as described above
ArrayList<VideoFile> videoFiles = video.files;

But recent version shows it as deprecated.
What is the new way of doing it???

Vimeo-Networking.jar file

Issue Summary

Is there a, or a plan for a jar file to be able to use the library?

Reproduction Steps

Detailed steps to reproduce the issue.
N/A

Expected Behavior

N/A

Actual Behavior

N/A

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.