Guys i am working on a project where i want to play a video coming from json. I want to use Jwplayer for this purpose please tell me How to Integrate JWPlayer in android studio.
1 Answers
Here we go: Importing the JW Player SDK into your project
There are two ways to import the JW Player SDK into your Android Studio project. Either through our Maven repository, or by downloading the .aar file from your Dashboard and importing it from your local machine.
Import using Maven
To add the SDK to your Android project using Maven. You must first edit your project's build.gradle file and add our Maven repository url
allprojects { repositories { ... maven { url 'https://mvn.jwplayer.com/content/repositories/releases/' } } }
Next, edit your application's build.gradle file and add the JW Player SDK dependency:
dependencies { ... compile 'com.longtailvideo.jwplayer:jwplayer-android-sdk:+' }
After syncing Gradle you should be able to use all JW Player SDK classes in your application.
Import from your local file system
If you do not wish to use our Maven repository you can always download our SDK package from your Dashboard and import the SDK from your local file system.
Downloading the JW Player SDK from your Dashboard
- Sign in to your JW Player dashboard at https://account.jwplayer.com
- Navigate to the Players section, center of the left navigation bar, then click on Tools
- In the Downloads section, locate the Android SDK and click on the download button
- Unzip the SDK package to your local hard drive.
Importing the SDK to your Android Studio Project
- Go to File > New > New Module… > Import .JAR / .AAR Package
- Navigate to the location where you unzipped the AAR file, select it, then click Finish
- Go to File > Project Structure…
- Make sure your app is selected in the left-hand pane, then click the Dependencies tab
- Click the plus sign in the lower left-hand corner of the dialog and choose Module Dependency
- Select the jwplayer-android-sdk module then click OK
- Click OK again to close the dialog, the JW Player SDK is now available in your project
Initial Project Configuration
To ensure proper player behavior the following entries need to be added to your AndroidManifest.xml
First, you must add your JW License Key and nest it within the element
<meta-data
android:name="JW_LICENSE_KEY"
android:value="{YOUR_LICENSE_KEY}" />
{YOUR_LICENSE_KEY} should be replaced with the JW Player License Key that is shown in the Tools page of your Dashboard.
Valid license editions include Ads, Enterprise and Trial. The application will crash throwing an AssertionError if an invalid license key is provided.
Next, modify the all tags that will contain a JW Player and add
<activity
...
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" >
This will allow you to handle orientation changes programmatically and will prevent Android from destroying the Activity upon rotation.
Additional Features
If you plan to use Google IMA advertising add the line below to the dependencies section of your application’s build.gradle file:
compile 'com.google.android.gms:play-services-ads:8.1.0'
If you plan to use Google IMA ads add the lines below as a child of the tag in your application’s AndroidManifest.xml:
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

- 751
- 3
- 17
-
Took me some time to figure this out, so figured would share. To lock in a version you need syntax like `compile 'com.longtailvideo.jwplayer:jwplayer-android-sdk:2.5.3+164'` replacing **+** with **2.5.3+164**. Also it seems that jwplayer has moved away from `jwplayer-android-sdk` and to `jwplayer-core, jwplayer-common` which is in the [documentation](https://developer.jwplayer.com/sdk/android/docs/developer-guide/getting-started/library-project-setup/) They moved to this new layout in [Version 2.6](https://developer.jwplayer.com/sdk/android/docs/developer-guide/about/release-notes/) – lockwobr Dec 26 '16 at 18:20