Search code examples
androidjwplayerlicense-key

Invalid License Key in JWPlayer using external URL


I am trying to play a Video using JWPlayer, with the URL: http://res.cloudinary.com/pawantrunkcloud/video/upload/v1489746294/g5ijnie2ri74loim4ezk.mp4

But when i try to play the Url I get the error as:

Invalid License Key

Invalid License Key

The Code to Play Video is as follows: public class VideoActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_videoplay);



        // Get a handle to the JWPlayerFragment
        JWPlayerFragment fragment = (JWPlayerFragment) getFragmentManager().findFragmentById(R.id.playerFragment);

        // Get a handle to the JWPlayerView
        JWPlayerView playerView = fragment.getPlayer();

        // Create a PlaylistItem
        PlaylistItem video = new PlaylistItem("https://res.cloudinary.com/pawantrunkcloud/video/upload/v1489746294/g5ijnie2ri74loim4ezk.mp4");

        // Load a stream into the player

        playerView.load(video);
    }//onCreate closes here.....
}//VideoActivity closes here....

Also, the License Keys are as follows:

public static final String JW_PLAYER_API_KEY = "tWdG7dmM";

public static final String JW_PLAYER_API_SECRET = "K5joAa8mzKQTHCGyndqgKbT7";

Also, the License keys are added in the Manifest:

<meta-data
            android:name="tWdG7dmM"
            android:value="K5joAa8mzKQTHCGyndqgKbT7"/>

Solution

  • It's not the license key. Go to the dashboard. In dashboard page on left side you can see tools. Select tools. In tools page you can see License Key for Ios, Android etc... Copy that and paste in the position of value. name is JW_LICENSE_KEY

    <meta-data android:name="JW_LICENSE_KEY" android:value="{Your License Key from dashboard--> Tools}"/>

    Just an FYI to every user.

    Don't replace JW_LICENSE_KEY with any key, its a hardcoded String. Put the license in the value part.