2012-04-10 14 views
0

で再ストリーミング私はicecast2ユーザの要求内容、Red5のがあることを知っている場合はRED5

から今私は再ストリーミングするのRed5を使ってしたいのRed5を実行している1台のサーバーおよびチャネル 約5-6他のサーバで実行icecast2を持っています内容はicecast2サーバに属し、それは

は、私の質問は、通常、静的なコンテンツをストリーミングRed5のは、私の状況では、私がしなければならないされ、再ストリーミングメディアを取得し、ユーザーに再ストリームに補正し、サーバーに接続しますスピードと帯域幅を指定したicecast2の動的コンテンツそれは可能ですか? アイデアを得るために見ることができる例はありますか?

答えて

1

StreamingProxy

import java.util.HashMap; 
import java.util.Map; 

import org.red5.server.adapter.MultiThreadedApplicationAdapter; 
import org.red5.server.api.IBasicScope; 
import org.red5.server.api.IConnection; 
import org.red5.server.api.IScope; 
import org.red5.server.api.stream.IBroadcastStream; 
import org.red5.server.stream.IBroadcastScope; 
import org.red5.server.stream.StreamingProxy; 

public class Application extends MultiThreadedApplicationAdapter implements IStreamListener { 

private Map<String, StreamingProxy> streamingProxyMap = new HashMap<String, StreamingProxy>(); 

public IBroadcastScope getBroadcastScope(IScope scope, String name) { 
    IBasicScope basicScope = scope.getBasicScope(IBroadcastScope.TYPE, 
      name); 
    if (!(basicScope instanceof IBroadcastScope)) { 
     return null; 
    } else { 
     return (IBroadcastScope) basicScope; 
    } 
} 

/** {@inheritDoc} */ 
@Override 
public boolean connect(IConnection conn, IScope scope, Object[] params) { 
    return true; 
} 

public void streamBroadcastStart(IBroadcastStream stream) 
{ 
    IScope scope = stream.getScope(); 
    IBroadcastScope bsScope = getBroadcastScope(scope, stream.getPublishedName()); 
    StreamingProxy proxy = new StreamingProxy(); 
    proxy.setHost("live.justin.tv"); 
    proxy.setApp("app"); 
    proxy.setPort(1935); 
    proxy.init(); 
    bsScope.subscribe(proxy, null); 
    proxy.start("MY_STRING", StreamingProxy.LIVE, null); 
    streamingProxyMap.put(stream.getPublishedName(), proxy); 
    stream.addStreamListener(this); 
} 

public void packetReceived(IBroadcastStream stream, IStreamPacket packet) 
{ 
    RTMPMessage m = RTMPMessage.build((IRTMPEvent) packet,packet.getTimestamp()); 
    streamer.pushMessage(null, m); 
}  

synchronized public void streamBroadcastClose(IBroadcastStream stream) { 
    StreamingProxy proxy = 
      streamingProxyMap.get(stream.getPublishedName()); 
    if (proxy != null) { 
      proxy.stop(); 
      IScope scope = stream.getScope(); 
      IBroadcastScope bsScope = getBroadcastScope(scope, stream.getPublishedName()); 
      if (bsScope != null) { 
       bsScope.unsubscribe(proxy); 
     } 
    } 
} 

/** {@inheritDoc} */ 
@Override 
public void disconnect(IConnection conn, IScope scope) { 
    super.disconnect(conn, scope); 
} 

} 
+0

が、私はそれが動作するはずだろうに、選択されたストリームをrestreamしたい場合は、私が –

+0

の新しいバージョンを持っていますか、別のサーバーに使用する1台のサーバーを再ストリーミング用どのような方法で同じ方法ですか? –

+0

を持っていない@JuanDiegoあなたはこの –

関連する問題