本文整理汇总了Java中org.red5.server.api.IConnection.getScope方法的典型用法代码示例。如果您正苦于以下问题:Java IConnection.getScope方法的具体用法?Java IConnection.getScope怎么用?Java IConnection.getScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.red5.server.api.IConnection
的用法示例。
在下文中一共展示了IConnection.getScope方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addListener
import org.red5.server.api.IConnection; //导入方法依赖的package包/类
/**
* Start recording the published stream for the specified broadcast-Id
*
* @param conn
* @param broadcastid
* @param streamName
* @param metaId
* @param isScreenSharing
* @param isInterview
*/
private void addListener(IConnection conn, String broadcastid, String streamName, Long metaId, boolean isScreenSharing, boolean isInterview) {
log.debug("Recording show for: {}", conn.getScope().getContextPath());
log.debug("Name of CLient and Stream to be recorded: {}", broadcastid);
log.debug("Scope " + conn);
log.debug("Scope " + conn.getScope());
// Get a reference to the current broadcast stream.
ClientBroadcastStream stream = (ClientBroadcastStream) scopeAdapter.getBroadcastStream(conn.getScope(), broadcastid);
if (stream == null) {
log.debug("Unable to get stream: {}", streamName);
return;
}
// Save the stream to disk.
log.debug("### stream: [{}, name: {}, scope: {}, metaId: {}, sharing ? {}, interview ? {}]"
, stream, streamName, conn.getScope(), metaId, isScreenSharing, isInterview);
StreamListener streamListener = new StreamListener(!isScreenSharing, streamName, conn.getScope(), metaId, isScreenSharing, isInterview);
streamListeners.put(metaId, streamListener);
stream.addStreamListener(streamListener);
}
示例2: register
import org.red5.server.api.IConnection; //导入方法依赖的package包/类
/**
* Associate connection with client
*
* @param conn
* Connection object
*/
protected void register(IConnection conn) {
if (log.isDebugEnabled()) {
if (conn == null) {
log.debug("Register null connection, client id: {}", id);
} else {
log.debug("Register connection ({}:{}) client id: {}", conn.getRemoteAddress(), conn.getRemotePort(), id);
}
}
if (conn != null) {
IScope scope = conn.getScope();
if (scope != null) {
log.debug("Registering for scope: {}", scope);
connections.add(conn);
} else {
log.warn("Clients scope is null. Id: {}", id);
}
} else {
log.warn("Clients connection is null. Id: {}", id);
}
}
示例3: appConnect
import org.red5.server.api.IConnection; //导入方法依赖的package包/类
@Override
public boolean appConnect(IConnection conn, Object[] params) {
if (conn != null && conn.getScope() != null && conn.getScope().getType() == ScopeType.APPLICATION) {
return false;
}
return super.appConnect(conn, params);
}
示例4: MessageSender
import org.red5.server.api.IConnection; //导入方法依赖的package包/类
public MessageSender(IConnection current, IScope _scope, String method, Object msg, IPendingServiceCallback callback) {
this.current = current;
scope = _scope == null && current != null ? current.getScope() : _scope;
this.method = method;
this.msg = msg;
this.callback = callback;
}
示例5: appDisconnect
import org.red5.server.api.IConnection; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void appDisconnect(IConnection conn) {
log.info("oflaDemo appDisconnect");
if (appScope == conn.getScope() && serverStream != null) {
serverStream.close();
}
super.appDisconnect(conn);
}
示例6: connect
import org.red5.server.api.IConnection; //导入方法依赖的package包/类
/**
* Connect to scope with parameters. To successfully connect to scope it must have handler that will accept this connection with given set of parameters. Client associated with connection is added to scope clients set, connection is registered as scope event listener.
*
* @param conn Connection object
* @param params Parameters passed with connection
* @return true on success, false otherwise
*/
public boolean connect(IConnection conn, Object[] params) {
log.debug("Connect - scope: {} connection: {}", this, conn);
if (enabled) {
if (hasParent() && !parent.connect(conn, params)) {
log.debug("Connection to parent failed");
return false;
}
if (hasHandler() && !getHandler().connect(conn, this, params)) {
log.debug("Connection to handler failed");
return false;
}
if (!conn.isConnected()) {
log.debug("Connection is not connected");
// timeout while connecting client
return false;
}
final IClient client = conn.getClient();
// we would not get this far if there is no handler
if (hasHandler() && !getHandler().join(client, this)) {
return false;
}
// checking the connection again? why?
if (!conn.isConnected()) {
// timeout while connecting client
return false;
}
// add the client and event listener
if (clients.add(client) && addEventListener(conn)) {
log.debug("Added client");
// increment conn stats
connectionStats.increment();
// get connected scope
IScope connScope = conn.getScope();
log.trace("Connection scope: {}", connScope);
if (this.equals(connScope)) {
final IServer server = getServer();
if (server instanceof Server) {
((Server) server).notifyConnected(conn);
}
}
return true;
}
} else {
log.debug("Connection failed, scope is disabled");
}
return false;
}
示例7: appConnect
import org.red5.server.api.IConnection; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean appConnect(IConnection conn, Object[] params) {
log.info("oflaDemo appConnect");
IScope appScope = conn.getScope();
log.debug("App connect called for scope: {}", appScope.getName());
// getting client parameters
Map<String, Object> properties = conn.getConnectParams();
if (log.isDebugEnabled()) {
for (Map.Entry<String, Object> e : properties.entrySet()) {
log.debug("Connection property: {} = {}", e.getKey(), e.getValue());
}
}
// Trigger calling of "onBWDone", required for some FLV players
// commenting out the bandwidth code as it is replaced by the mina filters
//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);
}