Building JWPlayer v6.12 from Source with an Embedded RTMPE Secret Key for use with Protected Wowza Server (for the rest of us)
Last Updated: 04/29/2015
Used to rebuild the current version of the player with an embedded secret code for use with the Wowza RTMPE stream security protocol. Must be built on a machine that can run old 32-bit versions of Java specifically the 1.5 JDK (this rules out OS X after Mavericks as Apple does not support it).
Build Machine Setup
Requirements
- 32-bit Windows XP/7/8.1
- 32-bit Java 1.5
- Ant 1.7.0
- Adobe Flex SDK 4.5.1
Installing Java 1.5
- Set the JAVA_HOME environment variable to the installation location of Java JDK root folder (usually C:\Program Files\Java\jdk1.5.0_22)
- Add the bin directory of the Java JDK to your system’s PATH environment variable by referencing the JAVA_HOME environment variable, this makes it so there is only one place that the Java JDK path needs to updated (%JAVA_HOME%\bin)
- Close all Command Prompt windows if any are open as they will not have the changes to the path you made until reopened
- Verify the system is now using Java 1.5 by opening a clean Command Prompt and executing the command java -version
Installing Apache Ant 1.7.0 (open build platform used in the Java world)
URL: http://archive.apache.org/dist/ant/binaries/
- Download the binary zip and extract it
- Copy the extracted folder to the C drive (C:\apache-ant-1.7.0)
- Add the Ant bin folder to the Windows PATH environment variable (C:\apache-ant-1.7.0\bin)
- Close all Command Prompt windows if any are open as they will not have the changes to the path you made until reopened
- Verify the system is now using Ant 1.7 by opening a clean Command Prompt and executing the command:
ant -version
Installing Flex SDK 4.5.1
URL: http://sourceforge.net/adobe/flexsdk/wiki/Download%20Flex%204.5/
- Create a new folder in the C drive called JWPlayer (C:\JWPlayer)
- Download the SDK zip archive and extract the contents to the JWPlayer folder (C:\JWPlayer\flex_sdk_4.5.1.21328A)
Installing the JWPlayer Source
URL: https://github.com/jwplayer/jwplayer/tree/release
- Download the 6.12 release of the JWPlayer source code (at this time it is the current release and is therefore in the release branch on GitHub, this will change as new releases come out)
- Extract the archive to the JWPlayer folder you created early (C:\JWPlayer\jwplayer-release-6.12)
Building the Player from Source
Update Build Properties
- Open the build.properties file located in the JWPlayer source folder you just extracted (C:\JWPlayer\jwplayer-release-6.12\build\build.properties)
- On line 11 change the ‘flexsdk’ key with the location of the Flex SDK, you must use Unix style file path (flexsdk = C:/JWPlayer/flex_sdk_4.5.1.21328A)
- On line 16 change the ‘execextension’ key with a ‘.exe’ as we are using Windows to build (execextension = .exe)
- Save and close the file
Update Player Version
- Open the PlayerVersion.as file (C:\JWPlayer\jwplayer-release-6.12\src\flash\com\longtailvideo\jwplayer\player\PlayerVersion.as)
- On line 5 change the value “JWPLAYER::version” to “6.12.0”
Adding the Secret Key
- Open the RTMPMediaProvider.as file (C:\JWPlayer\jwplayer-release-6.12\src\flash\com\longtailvideo\jwplayer\media\RTMPMediaProvider.as)
- On line 491 change var hash:String = TEA.decrypt(evt.info.secureToken, getConfigProperty(‘securetoken’)); to var hash:String = TEA.decrypt(evt.info.secureToken, “VALUE_OF_NEW_SECRET_KEY_GOES_HERE”);
Building
- Open a Command Prompt at the root of the JWPlayer’s source folder (C:\JWPlayer\jwplayer-release-6.12)
- Execute the command
ant -buildfile build\build.xml
Troubleshooting
So many different things can go wrong, way too many to list in this document, Google is a great resource 😉
Release Binaries
New player should be located in bin-release if the build was successful
Assets Created jwplayer.js, jwplayer.html5.js, jwplayer.flash.swf
Notes:
Adding a JAVA_HOME environment variable to your system and adding Java to your PATH by referencing JAVA_HOME, instructions can be found here https://kaanmutlu.wordpress.com/2013/04/26/setting-the-java_home-in-windows-7-64-bit/
Published by