I tried to calculate my ibeacon distance using android studio , i followed a video tutorial in http://www.software7.com/blog/creating-a-beacon-app-for-android-in-less-than-10-minutes-from-scratch/ , i did exactly the same as he did , however he didn't use android studio instead IntelliJ IDEA . The result should be appear at android monitor - logcat , but mine didn't
import android.os.RemoteException;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import org.altbeacon.beacon.Beacon;
import org.altbeacon.beacon.BeaconConsumer;
import org.altbeacon.beacon.BeaconManager;
import org.altbeacon.beacon.BeaconParser;
import org.altbeacon.beacon.Identifier;
import org.altbeacon.beacon.MonitorNotifier;
import org.altbeacon.beacon.RangeNotifier;
import org.altbeacon.beacon.Region;
import java.util.Collection;
public class MainActivity extends AppCompatActivity implements
BeaconConsumer {
public static final String TAG = "BeaconsEverywhere";
private BeaconManager beaconManager;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
beaconManager = BeaconManager.getInstanceForApplication(this);
beaconManager.getBeaconParsers().add(new BeaconParser()
.setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-
24,d:25-25"));
beaconManager.bind(this);
}
#Override
public void onBeaconServiceConnect() {
final Region region = new Region("myBeaons", Identifier.parse("2173E519-
9155-4862-AB64-7953AB146156"),null,null);
beaconManager.addMonitorNotifier(new MonitorNotifier() {
#Override
public void didEnterRegion(Region region) {
try {
Log.d(TAG,"didEnterRegion");
beaconManager.startRangingBeaconsInRegion(region);
} catch (RemoteException e) {
e.printStackTrace();
}
}
#Override
public void didExitRegion(Region region) {
try {
Log.d(TAG,"didExitRegion");
beaconManager.stopRangingBeaconsInRegion(region);
} catch (RemoteException e) {
e.printStackTrace();
}
}
#Override
public void didDetermineStateForRegion(int i, Region region) {
}
});
beaconManager.addRangeNotifier(new RangeNotifier() {
#Override
public void didRangeBeaconsInRegion(Collection<Beacon> beacons,
Region region) {
for(Beacon oneBeacon : beacons){
Log.d(TAG, "distance: " + oneBeacon.getDistance() + " id:" +
oneBeacon.getId1() + "/" + oneBeacon.getId2() + "/" +
oneBeacon.getId3());
}
}
});
try {
beaconManager.startMonitoringBeaconsInRegion(region);
}catch (RemoteException e){
e.printStackTrace();
}
}
#Override
protected void onDestroy() {
super.onDestroy();
beaconManager.unbind(this);
}
}
The first Image is my expectation , second is my result
would you guys help me to figure out what the problem is ?
I would add new debug lines like Log.d(TAG,"onCreate"); and Log.d(TAG,"onBeaconServiceConnect"); in each of those methods so you can tell what is going on, then look for those lines when you run your app. This will tell you how far your program is getting in the process.
I also suspect that you will need to use a different beacon parser expression than is listed here:
beaconManager.getBeaconParsers().add(new BeaconParser()
.setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-
24,d:25-25"));
If you are using an off-the-shelf iBeacon, you will need to replace that string with the iBeacon layout as can be found here:
https://beaconlayout.wordpress.com/
Don't worry about Android Studio vs. IntelliJ IDEA. The code shown should work fine using either IDE.
Related
I'm using the Altbeacon library (stable release 2.1.4) to detect beacons. If I do it in an Activity, I have no problems detecting them. However I can't get this to work from a service. Here's what I've got:
package com.ibeacontest.android;
import java.util.Collection;
import org.altbeacon.beacon.Beacon;
import org.altbeacon.beacon.BeaconConsumer;
import org.altbeacon.beacon.BeaconManager;
import org.altbeacon.beacon.BeaconParser;
import org.altbeacon.beacon.Identifier;
import org.altbeacon.beacon.RangeNotifier;
import org.altbeacon.beacon.Region;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
public class TestBestzBeaconService extends Service implements BeaconConsumer
{
private BeaconManager beaconManager;
private final String BEACON_UUID = "11687109-915f-4136-a1f8-e60ff514f96d";
private final int BEACON_MAJOR = 3;
#Override
public void onCreate() {
super.onCreate();
L.p("In TestBestzBeaconService onCreate()");
}
#Override
public IBinder onBind(Intent intent) {
return null;
}
#Override
public int onStartCommand (Intent intent, int flags, int startId) {
L.p("in TestBestzBeaconService onStartCommand()");
beaconManager = BeaconManager.getInstanceForApplication(this);
beaconManager.bind(this);
//iBeacons ?
BeaconParser bp0 = new BeaconParser();
bp0.setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24");
beaconManager.getBeaconParsers().add(bp0);
//Bluecats?
BeaconParser bp1 = new BeaconParser();
bp1.setBeaconLayout("m:2-3=0201,i:28-29,p:24-24");
beaconManager.getBeaconParsers().add(bp1);
return super.onStartCommand(intent, flags, startId);
}
#Override
public void onDestroy() {
L.p("In TestBestzBeaconService onDestroy()");
beaconManager.unbind(this);
}
#Override
public void onBeaconServiceConnect() {
L.p("In TestBestzBeaconService onBeaconServiceConnect()");
beaconManager.setRangeNotifier(new RangeNotifier() {
#Override
public void didRangeBeaconsInRegion(Collection<Beacon> arg0, Region arg1) {
L.p("In TestBestzBeaconService - anonymous didRangeBeaconsInRegion()");
}
});
Region region = new Region("myregion", Identifier.parse(BEACON_UUID), Identifier.fromInt(BEACON_MAJOR), null); //
try {
beaconManager.startRangingBeaconsInRegion(region);
} catch (RemoteException e) {
L.p("In TestBestzBeaconService onBeaconServiceConnect(), REMOTEEXCEPTION!");
}
}
private static class L
{
public static void p(String s) {
Log.i("beacon", s);
}
}
}
I'm calling this from an Activity as so:
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
startService(new Intent(this, TestBestzBeaconService.class));
}
}
The log output I'm getting is:
03-19 09:56:40.233: I/beacon(25210): In TestBestzBeaconService onCreate()
03-19 09:56:40.233: I/beacon(25210): in TestBestzBeaconService onStartCommand()
03-19 09:56:40.566: I/beacon(25210): In TestBestzBeaconService onBeaconServiceConnect()
Parts added to the AndroidManifest:
<!-- Needed for AltBeacon SDK -->
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
and inside the Application tag:
<!-- Needed for AltBeacon SDK -->
<service android:name="org.altbeacon.beacon.service.BeaconService"/>
<service android:name="com.ibeacontest.android.TestBestzBeaconService" />
...but no signs of beacons or the didRangeBeaconsInRegion log output. Any pointers?
As i know Monitoring only works in background while Ranging do not. Try firstly starting a Monitoring and then immediately when you enter Monitoring start Ranging.
Something like:
//Set Monitoring
mBeaconManager.setMonitorNotifier(new
MonitorNotifier() {
#Override
public void didEnterRegion (Region region){
Log.d("TEST", "ENTERED beacon region");
//Start Raning as soon as you detect a beacon
try {
mBeaconManager.startRangingBeaconsInRegion(mRegion);
} catch (RemoteException e) {
e.printStackTrace();
}
}
});
//Set Ranging
mBeaconManager.setRangeNotifier(new
RangeNotifier() {
#Override
public void didRangeBeaconsInRegion ( final Collection<Beacon> beacons, Region region){
if (beacons.size() > 0) {
Log.i(TAG, p("In TestBestzBeaconService - anonymous
}
}
});
try
{
//Start Monitoring
mBeaconManager.startMonitoringBeaconsInRegion(mRegion);
}
catch(RemoteException e)
{
e.printStackTrace();
}
Don't forget to add beacon service to Manifest:
<service
android:name="org.altbeacon.beacon.service.BeaconService"
android:enabled="true"
android:exported="true"
android:isolatedProcess="false"
android:label="beacon"></service>
<service
android:name="org.altbeacon.beacon.BeaconIntentProcessor"
android:enabled="true"></service>
note: In meantime check also lib project
The posted code is in a library project and contained the correct inserts in the AndroidManifest file, however the actual app project was missing this.
I believe normally this would cause the app to crash, but in this case it just wouldn't show beacons.
Adding this made it work.
I'm trying to implement an Android Activity that detects the IDTech card reader accepts a simple card swipe.
Below is the bare bones structure to my implementation for which I took help from here as well
The code:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import IDTech.MSR.XMLManager.StructConfigParameters;
import IDTech.MSR.uniMag.uniMagReader;
import IDTech.MSR.uniMag.uniMagReaderMsg;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends Activity implements uniMagReaderMsg {
private uniMagReader myUniMagReader = null;
private Button btnSwipe;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(myUniMagReader == null) {
myUniMagReader = new uniMagReader(this,this);
myUniMagReader.setSaveLogEnable(false);
myUniMagReader.setXMLFileNameWithPath(null);
myUniMagReader.loadingConfigurationXMLFile(true);
//myUniMagReader.setVerboseLoggingEnable(true);
myUniMagReader.registerListen();
}
btnSwipe = (Button) findViewById(R.id.button1);
btnSwipe.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
myUniMagReader.startSwipeCard();
}
});
}
#Override
public void onDestroy() {
myUniMagReader.stopSwipeCard();
myUniMagReader.unregisterListen();
myUniMagReader.release();
super.onDestroy();
}
#Override
public boolean getUserGrant(int arg0, String arg1) {
Log.d("UniMag", "getUserGrant -- " + arg1);
return true;
}
#Override
public void onReceiveMsgAutoConfigProgress(int arg0) {
// TODO Auto-generated method stub
Log.d("UniMag", "onReceiveMsgAutoConfigProgress");
}
#Override
public void onReceiveMsgCardData(byte arg0, byte[] arg1) {
Log.d("UniMag", "onReceiveMsgCardData");
Log.d("UniMag", "Successful swipe!");
}
final Handler swipeHandler = new Handler() {
#Override
public void handleMessage(Message msg) {
String text = (String)msg.obj;
TextView dataView = (TextView) findViewById(R.id.text_view);
dataView.setText(text);
}
};
#Override
public void onReceiveMsgCommandResult(int arg0, byte[] arg1) {
Log.d("UniMag", "onReceiveMsgCommandResult");
}
#Override
public void onReceiveMsgConnected() {
Log.d("UniMag", "onReceiveMsgConnected");
Log.d("UniMag", "Card reader is connected.");
}
#Override
public void onReceiveMsgDisconnected() {
Log.d("UniMag", "onReceiveMsgDisconnected");
if(myUniMagReader.isSwipeCardRunning()) {
myUniMagReader.stopSwipeCard();
}
myUniMagReader.release();
}
#Override
public void onReceiveMsgFailureInfo(int arg0, String arg1) {
Log.d("UniMag","onReceiveMsgFailureInfo -- " + arg1);
}
#Override
public void onReceiveMsgSDCardDFailed(String arg0) {
Log.d("UniMag", "onReceiveMsgSDCardDFailed -- " + arg0);
}
#Override
public void onReceiveMsgTimeout(String arg0) {
Log.d("UniMag", "onReceiveMsgTimeout -- " + arg0);
Log.d("UniMag","Timed out!");
}
#Override
public void onReceiveMsgToConnect() {
Log.d("UniMag","Swiper Powered Up");
}
#Override
public void onReceiveMsgToSwipeCard() {
Log.d("UniMag","onReceiveMsgToSwipeCard");
}
#Override
public void onReceiveMsgAutoConfigCompleted(StructConfigParameters arg0) {
Log.d("UniMag", "onReceiveMsgAutoConfigCompleted");
}
}
The issue here is that I only get these two messages in the Logcat
"Swiper is powered up" from onReceiveMsgToConnect()
And After a few seconds (maybe 20 sec)
"Timed out!" from onReceiveMsgTimeout() that sends back a string saying unable to connect to device. I have multiple IDTech devices and this happens the same on every device. Also, sometimes if I am lucky enough I do get:
"Card reader is connected." from onReceiveMsgConnected() that means it is connected. But this happens very rarely.
Any help would be very appreciated.
Thanks!
Okay so I got it working.
I was using an older version of the sdk (unimag.reader.android-1.0.0.jar) and the configuration xml file (idt_unimagcfg_default.xml). I simply updated them to the most recent version of the sdk and the xml.
New versions (as of December 2014)
SDK: IDT_UniMagSDKAndroid_v4.4.jar - xml: umcfg.4.4.1.xml
And the timeout problem is solved.
P.S: just as a side note, please also do visit their website for any device specific details you might need for the specific card swiper you are using.
For example: I was using a "Shuttle, Two-Track Secure Mobile MagStripe Reader" with a "HTC ONE" phone. After going on to this page here I figured that for HTC ONE I need to turn off my "Beats audio" to appropriately use this device.
I hope this helps.
Hello I'm currently using Radius Network Beacon SDK but unable to detect my beacons.
In didRangeBeaconsInRegion(Collection beacons, Region region) collection object size is 0
Please help me!!
RangingActivity Code-
import java.util.Collection;
import android.app.Activity;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import android.widget.EditText;
import org.altbeacon.beacon.AltBeacon;
import org.altbeacon.beacon.Beacon;
import org.altbeacon.beacon.BeaconConsumer;
import org.altbeacon.beacon.BeaconManager;
import org.altbeacon.beacon.BeaconParser;
import org.altbeacon.beacon.RangeNotifier;
import org.altbeacon.beacon.Region;
public class RangingActivity extends Activity implements BeaconConsumer {
protected static final String TAG = "RangingActivity";
private BeaconManager beaconManager = BeaconManager.getInstanceForApplication(this);
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ranging);
beaconManager.bind(this);
beaconManager.debug = true;
}
#Override
protected void onDestroy() {
super.onDestroy();
beaconManager.unbind(this);
}
#Override
protected void onPause() {
super.onPause();
}
#Override
protected void onResume() {
super.onResume();
}
#Override
public void onBeaconServiceConnect() {
beaconManager.setRangeNotifier(new RangeNotifier() {
#Override
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
if (beacons.size() > 0) {
EditText editText = (EditText)RangingActivity.this
.findViewById(R.id.rangingText);
Beacon firstBeacon = beacons.iterator().next();
logToDisplay("The first beacon "+firstBeacon.toString()+" is about "+firstBeacon.getDistance()+" meters away.");
}
}
});
try {
beaconManager.startRangingBeaconsInRegion(new Region("myRangingUniqueId", null, null, null));
//beaconManager.updateScanPeriods();
} catch (RemoteException e) { }
}
private void logToDisplay(final String line) {
runOnUiThread(new Runnable() {
public void run() {
EditText editText = (EditText)RangingActivity.this
.findViewById(R.id.rangingText);
editText.append(line+"\n");
}
});
}
}
You need a custom Parser to properly recognize that beacons.
Take a look at this answer:
Is this the correct layout to detect iBeacons with AltBeacon's Android Beacon Library?
You need to call the onBeaconConnect() in your onCreate function
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ranging);
beaconManager.bind(this);
beaconManager.debug = true;
onBeaconConnect()
}
I'm trying to start a very simple jWebSocket Client on Android and connect it to my local server. I'm using the JWC class from the demo together with jWebSocket 1.0 beta 8 and Android 4.0.3, my code looks like this:
import org.jwebsocket.api.WebSocketClientEvent;
import org.jwebsocket.api.WebSocketClientTokenListener;
import org.jwebsocket.api.WebSocketPacket;
import org.jwebsocket.client.token.BaseTokenClient;
import org.jwebsocket.kit.WebSocketException;
import org.jwebsocket.token.Token;
import android.app.Activity;
import android.content.Context;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import cased.smids.communication.JWC;
public class TasksActivity extends Activity implements WebSocketClientTokenListener {
Spinner spinner;
Button btn_Start;
/** Called when the activity is first created. */
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
this.setContentView(R.layout.main);
JWC.init();
spinner = (Spinner)findViewById(R.id.sp_Task);
btn_Start = (Button)findViewById(R.id.btn_Start);
ArrayAdapter<CharSequence> adapter =
ArrayAdapter.createFromResource(
this,
R.array.Tasks,
android.R.layout.simple_spinner_item
);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
btn_Start.setOnClickListener(new View.OnClickListener() {
public void onClick(View src) {
switch (src.getId()) {
case R.id.btn_Start:
if (spinner.getSelectedItem().toString().equals("Connect")) {
try {
System.out.println("connecting manually...");
JWC.open();
} catch (WebSocketException e) {
e.printStackTrace();
}
}
default:
break;
}
}
});
}
#Override
protected void onResume() {
super.onResume();
System.out.println("* opening... ");
try {
JWC.addListener(this);
JWC.open();
} catch (WebSocketException ex) {
System.out.println("* exception: " + ex.getMessage());
}
}
#Override
protected void onPause() {
System.out.println("* closing... ");
try {
JWC.close();
JWC.removeListener(this);
} catch (WebSocketException ex) {
System.out.println("* exception: " + ex.getMessage());
}
super.onPause();
}
public void processClosed(WebSocketClientEvent arg0) {
System.out.println("closed");
}
public void processOpened(WebSocketClientEvent arg0) {
System.out.println("opened");
}
public void processOpening(WebSocketClientEvent arg0) {
System.out.println("opening");
}
public void processPacket(WebSocketClientEvent arg0, WebSocketPacket arg1) {
System.out.println("packet");
}
public void processReconnecting(WebSocketClientEvent arg0) {
System.out.println("reconnecting");
}
public void processToken(WebSocketClientEvent arg0, Token arg1) {
System.out.println("token");
}
}
so basically it's just a spinner and a button. For now, all I want to do is connect to my local jWebSocketServer. The demo-app (the .apk package from the website, if I import the code eclipse tells me to remove many "#Overwrite" before it compiles the code - after that same "bug" occurs) works with my server so it has to be the code. Right now all I get is "connecting..." and about 0.1s later "closed". Every time.
btw. the app has the right INTERNET and ACCESS_NETWORK_STATE so that shouldn't be a problem.
i will be grateful for any help.
Cheers
Turns out, BaseTokenClient.open() is catching all exceptions and doing nothing about it (silent fail). In my case - NetworkOnMainThreadException. Mystery solved.
I am trying to implement the library from http://www.aftek.com/afteklab/aftek-RTMP-library.shtml
to stream live video from a red5 server.
On the server i am using the simpleBroadcaster and i want to stream it to the android phone.
my code:
package com.cu.reader;
import java.nio.channels.FileChannel;
import java.util.Map;
import com.al.rtmp.client.RtmpClient;
import com.al.rtmp.client.RtmpStream;
import com.al.rtmp.client.RtmpStreamFactory;
import com.al.rtmp.client.data.MetaData;
import com.al.rtmp.client.data.RTMPData;
import com.al.rtmp.client.data.VideoCodec;
import com.al.rtmp.message.Metadata;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class StreamreaderActivity extends Activity implements RtmpClient {
RtmpStream stream = null;
Boolean connected = false;
String server = "rtmp://216.224.181.197/oflaDemo/";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
stream = RtmpStreamFactory.getRtmpStream();
stream.setClient(this);
stream.connect(server);
}
#Override
public void streamCreated() {
Log.i("stream","Connected!");
connected = true;
stream.setPlayName("red5StreamDemo");
stream.play();
}
#Override
public byte[] getWriteData(int length) {
// TODO Auto-generated method stub
return null;
}
#Override
public void invoke(String arg0, Object... arg1) {
// TODO Auto-generated method stub
;
}
#Override
public void onDataReceived(RTMPData rtmpData) {
MetaData metaData = rtmpData.getMetaData();
VideoCodec vc = metaData.getVideoCodec();
}
#Override
public void onError(Exception ex) {
Log.e("ClientException", " Some exception occurred." + ex.getMessage());
ex.printStackTrace();
}
#Override
public void onMetaDataReceived(Map map) {
Log.i("code","METADATA:" + map);
}
#Override
public void onResult(String method, Object... arg1) {
Log.i("result","METADATA:" + method);
}
#Override
public void onStatus(String code) {
Log.i("code",code);
}
}
i am always receiving NetStream.Play.StreamNotFound in onStatus function.
Thank you
You get NetStream.Play.StreamNotFound error becouse such stream doesnt exist on red5 application.
I made quick as3 test to check:
package {
import flash.display.Sprite;
import flash.events.AsyncErrorEvent;
import flash.events.IOErrorEvent;
import flash.events.NetStatusEvent;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
public class LearnWowzaClient extends Sprite {
private var nc:NetConnection;
private var video:Video = new Video();
public function LearnWowzaClient() {
nc = new NetConnection();
nc.client = this;
nc.addEventListener(NetStatusEvent.NET_STATUS, onNet);
nc.connect("rtmp://216.224.181.197/oflaDemo/");
}
private function onNet(event:NetStatusEvent):void {
trace(event);
trace(event.info.code);
switch (event.info.code) {
case "NetConnection.Connect.Success":
tryPlayStream();
break;
}
}
private function tryPlayStream():void {
trace("playStream");
var ns:NetStream = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
ns.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
ns.play("red5StreamDemo");
video.attachNetStream(ns);
}
public function onBWCheck(parameter:Object = null):void {
trace("onBWCheck p=" + parameter);
}
public function onBWDone(parameter:Object = null):void {
trace("onBWDone p=" + parameter);
}
private function onIOError(event:IOErrorEvent):void {
trace("onIOError");
}
private function onAsyncError(event:AsyncErrorEvent):void {
trace("onAsyncError");
}
private function onNetStatus(event:NetStatusEvent):void {
trace("onNetStatus ", event.info.code);
}
}
}
I also get NetStream.Play.StreamNotFound error.
Can you show red5 application code?
The stream does not exist, correct. But why? Probably one or two reasons: you have not created a live broadcast stream and 2) because you are using the wrong scope. Unless you configure it differently by hand (which is unlikely), use the 'live' broadcaster scope, which is in /live.
Thus, publish to rtmp://216.224.181.197/live/red5StreamDemo and to subscribe to the exact same mrl, in this example rtmp://216.224.181.197/live/red5StreamDemo. NOTE: for this to work, you need to create a 'live' stream and feed it to your RED5 server. You can use avconv (aka ffmpeg) to create an rtmp feed.