I’m trying to get the livestream plugin from jwplayer to work with my wowza stream.
my stream has a security token and it looks like the plugin doesnt handle that.
INFO server comment - SecureURLParams.onAppStart: hodtv_live/_definst_
INFO application app-start _definst_ hodtv_live/_definst_
INFO session connect-pending xxx.xxx.xxx.xxx -
INFO session connect xxx.xxx.xxx.xxx -
INFO stream create - -
INFO server comment - SecureURLParams: play: rejected
my livestream code is :
livestream.streamer=rtmp://myurl/hodtv_live/_definst_/doConnect=connecttoken&livestream.file=live.sdp
this is my application
<Property>
<Name>secureTokenSharedSecret</Name>
<Value>verysecret</Value>
</Property>
<Property>
<Name>secureurlparams.connect</Name>
<Value>connecttoken.doConnect</Value>
</Property>
<Property>
<Name>secureurlparams.publish</Name>
<Value>Tokenpub.doPublish</Value>
</Property>
the stream works perfect with just jw-player and token build in the source code.
here is the source for livestream plugin:
package com.jeroenwijering.plugins {
import com.jeroenwijering.events.*;
import com.jeroenwijering.utils.Logger;
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.setTimeout;
import flash.text.*;
/**
* This plugin automatically polls an RTMP stream for availability every XX seconds.
* If the stream is available, it will kick in.
* It allows users to wait for a live event without having to refresh their page.
**/
public class Livestream extends MovieClip implements PluginInterface {
[Embed(source="../../../animation.swf")]
private const Animation:Class;
/** Background image. **/
private var back:Sprite;
/** List with configuration settings. **/
public var config:Object = {
file:undefined,
image:undefined,
interval:15,
message:'Checking for livestream...',
streamer:undefined,
tags:undefined
};
/** Netconnection instance to check availability. **/
private var connection:NetConnection;
/** The number times the plugin tried to connect. **/
private var count:Number = 0;
/** The textfield showing all messages. **/
private var field:TextField;
/** Netstream instance to check availability. **/
private var stream:NetStream;
/** Reference to the view. **/
private var view:AbstractView;
/** Constructor. **/
public function Livestream():void {
connection = new NetConnection();
buildStage();
};
/** Build all stage graphics. **/
private function buildStage():void {
back = new Sprite();
back.graphics.beginFill(0x000000,0.6);
back.graphics.drawRect(0,0,300,70);
addChild(back);
var anm:DisplayObject = new Animation();
anm.x = 134;
anm.y = 10;
addChild(anm);
field = new TextField();
field.defaultTextFormat = new TextFormat('_sans',13,0xFFFFFF,null,null,null,null,null,TextFormatAlign.CENTER);
field.width = 300;
field.height = 20;
field.y = 45;
addChild(field);
mouseEnabled = false;
visible = false;
};
/** Try connecting to the livestream. **/
private function checkStream():void {
count++;
connection.addEventListener(NetStatusEvent.NET_STATUS,statusHandler);
connection.connect(config['streamer']);
visible = true;
setTimeout(hide,2000);
Logger.log('checking for stream; attempt: '+count,'livestream');
};
/** Hide the icon again after a check. **/
private function hide():void {
visible = false;
};
/**
* Start the plugin.
*
* @param vie A reference to the View of the player; the API entrypoint.
**/
public function initializePlugin(vie:AbstractView):void {
view = vie;
if(!config['tags'] || config['tags'] == view.config['tags']) {
view.config['icons'] = false;
view.config['repeat'] = 'always';
setTimeout(checkStream,2000);
view.addControllerListener(ControllerEvent.RESIZE,resizeHandler);
field.text = config['message'];
}
};
/** The livestream is found. Now switch to it. **/
private function loadStream():void {
view.config['autostart'] = true;
view.config['icons'] = true;
view.config['repeat'] = 'none';
var obj:Object = {
duration:0,
file:config['file'],
image:config['image'],
streamer:config['streamer'],
type:'rtmp'
}
view.sendEvent('LOAD',obj);
};
/** Reposition the icon on resize. **/
private function resizeHandler(evt:ControllerEvent):void {
x = config['x'] + config['width']/2 - 150;
y = config['y'] + config['height']/2 - 35;
};
/** Receive NetStream status updates. **/
private function statusHandler(evt:NetStatusEvent):void {
switch(evt.info.code) {
case 'NetConnection.Connect.Success':
stream = new NetStream(connection);
stream.client = new Object();
stream.addEventListener(NetStatusEvent.NET_STATUS,statusHandler);
stream.play(config['file']);
Logger.log('connected to server '+config['streamer'],'livestream');
break;
case 'NetStream.Play.Start':
stream.removeEventListener(NetStatusEvent.NET_STATUS,statusHandler);
connection.removeEventListener(NetStatusEvent.NET_STATUS,statusHandler);
stream.close();
connection.close();
setTimeout(loadStream,2000);
Logger.log('found stream '+config['file'],'livestream');
break;
case 'NetStream.Play.StreamNotFound':
case 'NetConnection.Connect.Failed':
stream.removeEventListener(NetStatusEvent.NET_STATUS,statusHandler);
connection.removeEventListener(NetStatusEvent.NET_STATUS,statusHandler);
setTimeout(checkStream,config['interval']*1000);
Logger.log('no livestream yet: '+evt.info.code,'livestream');
break;
}
};
};
}
Does anyone know how to fix this problem? couse i think this plugin is very usefull for livestreamers
Grz
Terrorhawk