Creating a Secure Token SWF for JW Player 5.2

Posted by Derrick217 on August 15, 2010 under Video Streaming and Compression | Be the First to Comment

Creating a Secure Token .SWF for JW Player 5.2 is a process that many delivering secure streaming video content will need to perform. Wowza Media Server 2 supports Secure Token streaming with JW Player 5.2 for video playback. To get this going you must first set up your Secure Token application and have it running on Wowza Media Server 2.  To create a JW Player 5.2 .SWF file that has Secure Token you must first have Flash Professional CS5 and Flex SDK installed. Here are some notes for installing the Flex SDK.

In this tutorial you’ll learn how to create a .SWF file that has your desired Secure Token value using Flash Professional CS5. (Technically you’ll also be using the Flex SDK as well.).  First make sure you download the source code for JW Player 5.2 from trunk from the link below:

http://developer.longtailvideo.com/trac/browser/trunk/fl5

Note: This tutorial is for compiling with the non-commercial JW Player 5.2 license.

Let’s get started with the tutorial.  In Flash Professional CS5 navigate to the File Pull-down menu and choose New to create a new .FLA document.

When the dialog appears select ActionScript 3.0.

Next, you need to save your new document by navigating to the File Menu and choosing Save.

Name your new .FLA file securetoken_sample.fla and save it to the trunk\fl5\src folder within trunk on your computer.

Within your securetoken_sample.fla file move to the Properties Tab and input com.longtailvideo.jwplayer.player.Player into the Class Text box under Publish.

Now, choose Preferences from the File Pull-down menu.

Click on the ActionScript Category

and select the ActionScript 3.0 Settings button

When the Dialog opens, in the Flex SDK Path Text box enter the path to your Flex SDK.

Next, choose Publish Settings from under the File Pull-down menu.

When the Dialog opens choose the Flash tab and click the Settings button next to the Script Drop-down menu where ActionScript 3.0 appears.

Under the Library path tab, edit the entry for $(FlexSDK)/frameworks/libs/flex.swc to read $(FlexSDK)/frameworks/libs by removing flex.swc.  After you make the changes choose OK.

That’s all you need to do to set things up in your securetoken_sample.fla.

You can now open the RTMPMediaProvider.as file within \trunk\fl5\src\com\longtailvideo\jwplayer\media. Next, you’re going to add your Secure Token value that matches the value you have in your Secure Token application on Wowza Media Server 2.

Once you have your RTMPMediaProvider.as file open scroll down approximately to Line 462 and change the following information in your file:

from this:

_connection.call(“secureTokenResponse”, null, TEA.decrypt(evt.info.secureToken, config.token));

to this:
_connection.call(“secureTokenResponse”, null, TEA.decrypt(evt.info.secureToken, “#sa%m0#p@7″));

If you’re following along with the Wowza Media Systems’ tutorial use the default secure token value that they’ve supplied and change your RTMPMediaProvider.as file

to display this:

_connection.call(“secureTokenResponse”, null, TEA.decrypt(evt.info.secureToken, “#ed%h0#w@1″));

After you apply your settings you can save your RTMPMediaProvider.as file and close it.

Finally, you can go back to your securetoken_sample.fla file to export out a new .SWF.  In Flash Professional CS5 navigate to the File pull-down menu and choose Export Movie from the Export Sub-menu.

Save your file in the src folder you saved your securetoken_sample.fla file in earlier and name the new .SWF file securetoken_sample.swf and choose Save.  Congratulations! Now you can take your new .SWF file with Secure Token and use it for authoring your web pages with JW Player 5.2.

Comments are closed.