Wowza Community

Using JW Player 4 with Wowza Server

https://www.wowza.com/docs/how-to-use-longtail-jw-player-4-with-wowza-media-server

hi,

in my case, Extremists.m4v file does not stream with mp4: prefix, but it’s working without the prefix. Is something wrong with my installation?

the exact code I use is:

<embed type="application/x-shockwave-flash" id="player4" name="player4" src="player_4.6.swf" width="320" height="240" allowscriptaccess="always" allowfullscreen="true" flashvars="streamer=IP:1935/simplevideostreaming&file=Extremists.m4v&type=rtmp&autostart=true" />

Note: To play H.264 or MP3 content that is in a folder inside of the [install-dir]/content folder, prepend mp4: and mp3: respectively to the folder name. For example, to play the media file:

you are going to setup an application named simplevideostreaming to stream pre-recorded video content from the [install-dir]/content folder.

Instructions

  • Download and install Wowza Media Server

  • Create the folder [install-dir]/applications/simplevideostreaming to server as the Wowza Server application folder (may already exist if examples installed)

  • Download the JW Player and unzip

  • Edit the readme.html in root directory of the zip archive, and make the following changes to the script section (starting around line 24):

    <script type="text/javascript">
    	var s1 = new SWFObject("player.swf","ply","328","200","9","#FFFFFF");
    	s1.addParam("allowfullscreen","true");
    	s1.addParam("allowscriptaccess","always");
    	s1.addParam("flashvars","fullscreen=true&bufferlength=2&streamer=rtmp://[server-ip-address]/simplevideostreaming&file=Extremists");
    	s1.write("container");
    </script>
    
    

    where:

    [server-ip-address]: is the ip address of your server running Wowza Server

    simplevideostreaming: is the name of the Wowza Server application

    Extremists: is the name of the sample FLV video that ships with Wowza Server

    We are setting the client side bufferlength to 2 seconds

    To play the H.264 example video, the changes would look like this:

    <script type="text/javascript">
    	var s1 = new SWFObject("player.swf","ply","328","200","9","#FFFFFF");
    	s1.addParam("allowfullscreen","true");
    	s1.addParam("allowscriptaccess","always");
    	s1.addParam("flashvars","fullscreen=true&bufferlength=2&streamer=rtmp://[server-ip-address]/simplevideostreaming&file=mp4:Extremists.m4v");
    	s1.write("container");
    </script>
    
    
  • Due to a security restriction in Flash, it is necessary to host the following files at your web server: readme.html, player.swf, swfobject.js and yt.swf (they all need to be in the same folder). To play, open a web browser and enter the url for the readme.html file.

    If you want to play the video locally without hosting the file at your a web server, follow these instructions to add the player.swf file to your list of trusted SWF files.

  • Right click on the flash movie below the title single file, with preview image and select Settings… from the popup menu.

  • Click the Advance… button and it will pop open a browser window.

  • Click the Global Security Settings Panel link.

  • A new web page will open with a flash swf file in the top right corner.

  • In this flash movie select Add location… from the Edit locations… popup.

  • Select Browse for files… and select the player.swf that is in the same folder with the readme.html file and click Open

  • To play, close all open web browsers windows and double click readme.html.

    [install-dir]

    Windows (default): C:\Program Files\Wowza Media Systems\Wowza Media Server Pro [version]

    Mac OS X: /Library/WowzaMediaServerPro

    Linux: /usr/local/WowzaMediaServerPro

    Note: There is currently an issue with JW Player 4.0 and RTP/MPEG-TS player. When using JW Player 4.0 to playback one of these two methods of live streaming the video will not be present. The problem is that JW Player currently requires that the width and height values to be set properly in the onMetaData event. When streaming using RTP/MPEG-TS Wowza Server does not have access to the width and height information for the stream. I am currently working with the developer of JW Player to see if there is a way to work around this issue. In the meantime you can download the source code for JW Player from here: http://code.jeroenwijering.com/trac/browser/tags (filename: mediaplayer-4-0.zip)

    Edit the file: com/jeroenwijering/models/RTMPModel.as

    Change the onMetaData handler to the code below, change the 320 and 240 values to the frame size of your video and publish the new player:

    public function onData(dat:Object) {
    	if(dat.type == 'metadata' && !metadata) {
    		metadata = true;
    		if(dat.width) {
    			video.width = dat.width;
    			video.height = dat.height;
    			model.mediaHandler(video);
    		} else {
    			video.width = 320;
    			video.height = 240;
    			model.mediaHandler(video);
    		}
    		if(model.playlist[model.config['item']]['start'] > 0) {
    			seek(model.playlist[model.config['item']]['start']);
    		}
    	} else if(dat.type == 'complete') {
    		fileindex = undefined;
    		clearInterval(timeinterval);
    		model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.COMPLETED});
    	}
    	model.sendEvent(ModelEvent.META,dat);
    };
    
    

    Charlie

    i tried this and my player is just stale and shows the play arrow and command bar and does not react to any clicks. jwplayer4.0

I notice that the JW Player is now on version 5.0. I am guessing the problem still exists (aka it doesn’t know the height/width)? I was going through the code and it appears they are using a new architecture. I would assume the new file would be com/longtailvideo/jwplayer/media/RTMPMediaProvider.as.

Granted it does not lend itself to this simple fix any longer. You wouldn’t have any info on this would you?

I’m not very familiar with the JW Player code but I am not sure the problem even still persists other than I am never seeing any video.

There are some changes between JW Media Player 4 and 5. The “type=rtmp” is now required, and there are some changes between ‘id’ and ‘location’ in the playlist.

We just upgraded tobaccovideos.com (http://www.tobaccovideos.com/) today, it uses Wowza Media Server 2 and JW Media Player, streaming via a playlist. A sample playlist looks like this

<playlist version="1.1" xmlns="http://xspf.org/ns/0/"> 
	<title>Selected Videos</title> 
	<info>http://www.tobaccovideos.com</info> 
	<trackList> 
<track> 
	<title>The EFFECTS of SMOKING CHESTERFIELD CIGARETTES</title> 
	<location>videos/originals/commercials/chesterfield_dvd_6/001chesterfield.mp4</location> 
	<image>http://tobaccovideos.com/videos/thumb/118.jpg</image> 
	<meta rel='captions'>/player/video_captions.php?video_id=118</meta> 
	<meta rel='streamer'>rtmp://tobaccovideos.com:1935/simplevideostreaming</meta> 
	<meta rel='type'>rtmp</meta> 
</track> 
 
<track> 
	<title>I have some good news why you should change to Chesterfield</title> 
	<location>videos/originals/commercials/chesterfield_dvd_6/002chesterfield.mp4</location> 
	<image>http://tobaccovideos.com/videos/thumb/119.jpg</image> 
	<meta rel='captions'>/player/video_captions.php?video_id=119</meta> 
	<meta rel='streamer'>rtmp://tobaccovideos.com:1935/simplevideostreaming</meta> 
	<meta rel='type'>rtmp</meta> 
</track> 
 
 
</trackList> 
</playlist>

It took much longer than I’d like to admit to get everything working, since JW Media Player isn’t well documented in certain areas (like what’s changed in an upgrade).

Tac

Wink player looks interesting, but it appears to be completely stand-alone, no API or Javascript integration other than invoking it. JW Media Player has a whole API library, although at the moment it seems be in transition from the Version 4 API to Version 5.

I couldn’t find anything on the Wink site about integrating Javascript. Of particular importance to us is the ability to seek, and also to receive events.

On a note related to Wowza, it would be FABULOUS if the log reported both what the SEEK request was and where the SEEK actually went to. Right now the log reports a SEEK, so it seems trivial to add the argument that came in.

SEEK seems to automatically start playing as well, although I think that might be a JW issue rather than Wowza.

Tac

Here are revised instructions:

http://www.wowza.com/forums/showthread.php?p=34880

Also, use “provider=rtmp” in JW Player 5

Richard

Nothing is wrong, it’s because JW Player is adding the prefix. If you add it, it’s being added again anyway.

Richard

in the JW Player “file” Flashvar, e.g. “&file=mp4:sample.mp4”

“mp4:” is the prefix. In some versions of JW Player it caused a problem to add this prefix. I don’t think it is a problem in current version. But you can try with and without.

Richard

Nothing is wrong, it’s because JW Player is adding the prefix. If you add it, it’s being added again anyway.

Richard

What type of prefix? Do you know exactly?