Red5 フリーソフトのFlashストリーミングサーバ ~開発クライアントの構築 その7~
・変更前
package org.red5.demos.oflaDemo2;
import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
import org.red5.server.api.stream.IServerStream;
public class Application extends ApplicationAdapter {
private IServerStream serverStream;
/** {@inheritDoc} */
@Override
public boolean appStart(IScope app) {
super.appStart(app);
log.info("oflaDemo appStart");
System.out.println("oflaDemo appStart");
//Get plugin
//AuthPlugin authPlugin = (AuthPlugin) PluginRegistry.getPlugin("authPlugin");
//Get the handler (application listener in this case) that you want
//FMSAuthenticationHandler authHandler = authPlugin.getFMSAuthenticationHandler();
//Red5AuthenticationHandler authHandler = authPlugin.getRed5AuthenticationHandler();
//Add the handler as a listener for your app (in appStart or where-ever)
//addListener(authHandler);
return true;
}
/** {@inheritDoc} */
@Override
public boolean appConnect(IConnection conn, Object[] params) {
log.info("oflaDemo appConnect");
// Trigger calling of "onBWDone", required for some FLV players
/*
measureBandwidth(conn);
if (conn instanceof IStreamCapableConnection) {
IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
SimpleConnectionBWConfig bwConfig = new SimpleConnectionBWConfig();
bwConfig.getChannelBandwidth()[IBandwidthConfigure.OVERALL_CHANNEL] =
1024 * 1024;
bwConfig.getChannelInitialBurst()[IBandwidthConfigure.OVERALL_CHANNEL] =
128 * 1024;
streamConn.setBandwidthConfigure(bwConfig);
}
*/
// if (appScope == conn.getScope()) {
// serverStream = StreamUtils.createServerStream(appScope, "live0");
// SimplePlayItem item = new SimplePlayItem();
// item.setStart(0);
// item.setLength(10000);
// item.setName("on2_flash8_w_audio");
// serverStream.addItem(item);
// item = new SimplePlayItem();
// item.setStart(20000);
// item.setLength(10000);
// item.setName("on2_flash8_w_audio");
// serverStream.addItem(item);
// serverStream.start();
// try {
// serverStream.saveAs("aaa", false);
// serverStream.saveAs("bbb", false);
// } catch (Exception e) {}
// }
return super.appConnect(conn, params);
}
/** {@inheritDoc} */
@Override
public void appDisconnect(IConnection conn) {
log.info("oflaDemo appDisconnect");
if (scope == conn.getScope() && serverStream != null) {
serverStream.close();
}
super.appDisconnect(conn);
}
}
・変更後
package org.red5.demos.oflaDemo2;
import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
import org.red5.server.api.stream.IServerStream;
// 追加
import org.red5.server.api.IBandwidthConfigure;
import org.red5.server.api.stream.IStreamCapableConnection;
import org.red5.server.api.stream.support.SimpleConnectionBWConfig;
public class Application extends ApplicationAdapter {
private IServerStream serverStream;
/** {@inheritDoc} */
@Override
public boolean appStart(IScope app) {
super.appStart(app);
log.info("oflaDemo appStart");
System.out.println("oflaDemo appStart");
//Get plugin
//AuthPlugin authPlugin = (AuthPlugin) PluginRegistry.getPlugin("authPlugin");
//Get the handler (application listener in this case) that you want
//FMSAuthenticationHandler authHandler = authPlugin.getFMSAuthenticationHandler();
//Red5AuthenticationHandler authHandler = authPlugin.getRed5AuthenticationHandler();
//Add the handler as a listener for your app (in appStart or where-ever)
//addListener(authHandler);
return true;
}
/** {@inheritDoc} */
@Override
public boolean appConnect(IConnection conn, Object[] params) {
log.info("oflaDemo appConnect");
// Trigger calling of "onBWDone", required for some FLV players
measureBandwidth(conn);
if (conn instanceof IStreamCapableConnection) {
IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
SimpleConnectionBWConfig bwConfig = new SimpleConnectionBWConfig();
bwConfig.getChannelBandwidth()[IBandwidthConfigure.OVERALL_CHANNEL] = 1024 * 1024;
bwConfig.getChannelInitialBurst()[IBandwidthConfigure.OVERALL_CHANNEL] = 128 * 1024;
streamConn.setBandwidthConfigure(bwConfig);
}
Eclipseで実行(コンパイル)していきます。
実行(コンパイル)、およびは、動作確認については、前回の記事「Red5 フリーソフトのFlashストリーミングサーバ ~開発クライアントの構築 その6~」を参照してください。
ここまでが、開発クライアントに関する記事となります。
Red5 ~クライアント開発~
Red5 フリーソフトのFlashストリーミングサーバ ~開発クライアントの構築 その1~
Red5 フリーソフトのFlashストリーミングサーバ ~開発クライアントの構築 その2~
Red5 フリーソフトのFlashストリーミングサーバ ~開発クライアントの構築 その3~
Red5 フリーソフトのFlashストリーミングサーバ ~開発クライアントの構築 その4~
Red5 フリーソフトのFlashストリーミングサーバ ~開発クライアントの構築 その5~
Red5 フリーソフトのFlashストリーミングサーバ ~開発クライアントの構築 その6~
Red5 フリーソフトのFlashストリーミングサーバ ~開発クライアントの構築 その7~
Red5 ~demoアプリのまとめ~
Red5 フリーソフトのFlashストリーミングサーバ ~demoアプリのまとめ その1~
Red5 フリーソフトのFlashストリーミングサーバ ~demoアプリのまとめ その2~
Red5 フリーソフトのFlashストリーミングサーバ ~demoアプリのまとめ その3~
Red5 ~サーバを構築しよう~
Red5 フリーソフトのFlashストリーミングサーバ ~サーバを構築しよう その1~
Red5 フリーソフトのFlashストリーミングサーバ ~サーバを構築しよう その2~
Red5 フリーソフトのFlashストリーミングサーバ ~サーバを構築しよう その3~
Red5 フリーソフトのFlashストリーミングサーバ ~サーバを構築しよう その4~
Red5 フリーソフトのFlashストリーミングサーバ ~サーバを構築しよう その5~
Red5 フリーソフトのFlashストリーミングサーバ ~サーバを構築しよう その6~
Flash Media Server
Flash Media Server①
Flash Media Server②
Flash Media Server③
Flash Media Server④
Flash Media Server⑤
Flash Media Server⑥
Flash Media Server⑦
Flash Media Server⑧
Flash Media Server⑨
Flash Media Server⑩