当前位置: 首页>>代码示例>>Java>>正文


Java IClientBroadcastStream类代码示例

本文整理汇总了Java中org.red5.server.api.stream.IClientBroadcastStream的典型用法代码示例。如果您正苦于以下问题:Java IClientBroadcastStream类的具体用法?Java IClientBroadcastStream怎么用?Java IClientBroadcastStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IClientBroadcastStream类属于org.red5.server.api.stream包,在下文中一共展示了IClientBroadcastStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initStream

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
public void initStream(Number streamId) {
    IConnection conn = Red5.getConnectionLocal();
    log.info("initStream stream id: {} current stream id: {} connection: {}", streamId, conn.getStreamId(), conn.getSessionId());
    if (conn instanceof IStreamCapableConnection) {
        ((IStreamCapableConnection) conn).reserveStreamId(streamId);
        IClientStream stream = ((IStreamCapableConnection) conn).getStreamById(streamId);
        if (stream != null) {
            if (stream instanceof IClientBroadcastStream) {
                IClientBroadcastStream bs = (IClientBroadcastStream) stream;
                IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
                if (bsScope != null && conn instanceof BaseConnection) {
                    ((BaseConnection) conn).unregisterBasicScope(bsScope);
                }
            }
            stream.close();
        }
        ((IStreamCapableConnection) conn).deleteStreamById(streamId);
    } else {
        log.warn("ERROR in initStream, connection is not stream capable");
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:23,代码来源:StreamService.java

示例2: initStream

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
public void initStream(int streamId) {
	IConnection conn = Red5.getConnectionLocal();
	if (conn instanceof IStreamCapableConnection) {
		((IStreamCapableConnection) conn).reserveStreamId(streamId);
		IClientStream stream = ((IStreamCapableConnection) conn).getStreamById(getCurrentStreamId());
		if (stream != null) {
			if (stream instanceof IClientBroadcastStream) {
				IClientBroadcastStream bs = (IClientBroadcastStream) stream;
				IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
				if (bsScope != null && conn instanceof BaseConnection) {
					((BaseConnection) conn).unregisterBasicScope(bsScope);
				}
			}
			stream.close();
		}
		((IStreamCapableConnection) conn).deleteStreamById(getCurrentStreamId());
	} else {
		log.warn("ERROR in intiStream, connection is not stream capable");
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:22,代码来源:StreamService.java

示例3: newBroadcastStream

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
public IClientBroadcastStream newBroadcastStream(int streamId) {
	if (isValidStreamId(streamId)) {
		// get ClientBroadcastStream defined as a prototype in red5-common.xml
		ClientBroadcastStream cbs = (ClientBroadcastStream) scope.getContext().getBean("clientBroadcastStream");
		Integer buffer = streamBuffers.get(streamId - 1);
		if (buffer != null) {
			cbs.setClientBufferDuration(buffer);
		}
		cbs.setStreamId(streamId);
		cbs.setConnection(this);
		cbs.setName(createStreamName());
		cbs.setScope(this.getScope());

		registerStream(cbs);
		usedStreams.incrementAndGet();
		return cbs;
	}
	return null;
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:21,代码来源:RTMPConnection.java

示例4: onChunkSize

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void onChunkSize(RTMPConnection conn, Channel channel, Header source, ChunkSize chunkSize) {
	for (IClientStream stream : conn.getStreams()) {
		if (stream instanceof IClientBroadcastStream) {
			IClientBroadcastStream bs = (IClientBroadcastStream) stream;
			IBroadcastScope scope = bs.getScope().getBroadcastScope(bs.getPublishedName());
			if (scope == null) {
				continue;
			}
			OOBControlMessage setChunkSize = new OOBControlMessage();
			setChunkSize.setTarget("ClientBroadcastStream");
			setChunkSize.setServiceName("chunkSize");
			if (setChunkSize.getServiceParamMap() == null) {
				setChunkSize.setServiceParamMap(new HashMap<String, Object>());
			}
			setChunkSize.getServiceParamMap().put("chunkSize", chunkSize.getSize());
			scope.sendOOBControlMessage((IConsumer) null, setChunkSize);
			log.debug("Sending chunksize {} to {}", chunkSize, bs.getProvider());
		}
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:23,代码来源:RTMPHandler.java

示例5: deleteStream

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
public void deleteStream(IStreamCapableConnection conn, Number streamId) {
    IClientStream stream = conn.getStreamById(streamId);
    if (stream != null) {
        if (stream instanceof IClientBroadcastStream) {
            IClientBroadcastStream bs = (IClientBroadcastStream) stream;
            IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
            if (bsScope != null && conn instanceof BaseConnection) {
                ((BaseConnection) conn).unregisterBasicScope(bsScope);
            }
        }
        stream.close();
    }
    conn.unreserveStreamId(streamId);
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:16,代码来源:StreamService.java

示例6: newBroadcastStream

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
public IClientBroadcastStream newBroadcastStream(Number streamId) {
    if (isValidStreamId(streamId)) {
        // get ClientBroadcastStream defined as a prototype in red5-common.xml
        ClientBroadcastStream cbs = (ClientBroadcastStream) scope.getContext().getBean("clientBroadcastStream");
        customizeStream(streamId, cbs);
        if (!registerStream(cbs)) {
            cbs = null;
        }
        return cbs;
    }
    return null;
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:14,代码来源:RTMPConnection.java

示例7: onChunkSize

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void onChunkSize(RTMPConnection conn, Channel channel, Header source, ChunkSize chunkSize) {
    int requestedChunkSize = chunkSize.getSize();
    log.debug("Chunk size: {}", requestedChunkSize);
    // set chunk size on the connection
    RTMP state = conn.getState();
    // set only the read chunk size since it came from the client
    state.setReadChunkSize(requestedChunkSize);
    //state.setWriteChunkSize(requestedChunkSize);
    // set on each of the streams
    for (IClientStream stream : conn.getStreams()) {
        if (stream instanceof IClientBroadcastStream) {
            IClientBroadcastStream bs = (IClientBroadcastStream) stream;
            IBroadcastScope scope = bs.getScope().getBroadcastScope(bs.getPublishedName());
            if (scope == null) {
                continue;
            }
            OOBControlMessage setChunkSize = new OOBControlMessage();
            setChunkSize.setTarget("ClientBroadcastStream");
            setChunkSize.setServiceName("chunkSize");
            if (setChunkSize.getServiceParamMap() == null) {
                setChunkSize.setServiceParamMap(new HashMap<String, Object>());
            }
            setChunkSize.getServiceParamMap().put("chunkSize", requestedChunkSize);
            scope.sendOOBControlMessage((IConsumer) null, setChunkSize);
            log.debug("Sending chunksize {} to {}", chunkSize, bs.getProvider());
        }
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:31,代码来源:RTMPHandler.java

示例8: setClientBroadcastStream

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/**
 * Sets the client broadcast stream
 * 
 * @param clientBroadcastStream
 *            stream
 */
public void setClientBroadcastStream(IClientBroadcastStream clientBroadcastStream) {
    if (this.clientBroadcastStream != null) {
        log.info("ClientBroadcastStream already exists: {} new: {}", this.clientBroadcastStream, clientBroadcastStream);
    }
    this.clientBroadcastStream = clientBroadcastStream;
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:13,代码来源:BroadcastScope.java

示例9: deleteStream

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
public void deleteStream(IStreamCapableConnection conn, int streamId) {
	IClientStream stream = conn.getStreamById(streamId);
	if (stream != null) {
		if (stream instanceof IClientBroadcastStream) {
			IClientBroadcastStream bs = (IClientBroadcastStream) stream;
			IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
			if (bsScope != null && conn instanceof BaseConnection) {
				((BaseConnection) conn).unregisterBasicScope(bsScope);
			}
		}
		stream.close();
	}
	conn.unreserveStreamId(streamId);
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:16,代码来源:StreamService.java

示例10: getClientBroadcastStream

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/**
 * Returns the client broadcast stream
 */
public IClientBroadcastStream getClientBroadcastStream() {
    return clientBroadcastStream;
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:7,代码来源:BroadcastScope.java

示例11: getClientBroadcastStream

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/**
 * Returns the client broadcast stream
 */
public IClientBroadcastStream getClientBroadcastStream() {
	return clientBroadcastStream;
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:7,代码来源:BroadcastScope.java

示例12: closeStream

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/**
 * Close stream. This method can close both IClientBroadcastStream (coming from Flash Player to Red5) and ISubscriberStream (from Red5
 * to Flash Player). Corresponding application handlers (streamSubscriberClose, etc.) are called as if close was initiated by Flash
 * Player.
 * 
 * It is recommended to remember stream id in application handlers, ex.:
 * 
 * <pre>
 * public void streamBroadcastStart(IBroadcastStream stream) {
 *     super.streamBroadcastStart(stream);
 *     if (stream instanceof IClientBroadcastStream) {
 *         int publishedStreamId = ((ClientBroadcastStream) stream).getStreamId();
 *         Red5.getConnectionLocal().setAttribute(PUBLISHED_STREAM_ID_ATTRIBUTE, publishedStreamId);
 *     }
 * }
 * </pre>
 * 
 * <pre>
 * public void streamPlaylistItemPlay(IPlaylistSubscriberStream stream, IPlayItem item, boolean isLive) {
 *     super.streamPlaylistItemPlay(stream, item, isLive);
 *     Red5.getConnectionLocal().setAttribute(WATCHED_STREAM_ID_ATTRIBUTE, stream.getStreamId());
 * }
 * </pre>
 * 
 * When stream is closed, corresponding NetStream status will be sent to stream provider / consumers. Implementation is based on Red5's
 * StreamService.close()
 * 
 * @param conn
 *            client connection
 * @param streamId
 *            stream ID (number: 1,2,...)
 */
public void closeStream(IConnection conn, Number streamId) {
    log.info("closeStream  stream id: {} connection: {}", streamId, conn.getSessionId());
    if (conn instanceof IStreamCapableConnection) {
        IStreamCapableConnection scConn = (IStreamCapableConnection) conn;
        IClientStream stream = scConn.getStreamById(streamId);
        if (stream != null) {
            if (stream instanceof IClientBroadcastStream) {
                // this is a broadcasting stream (from Flash Player to Red5)
                IClientBroadcastStream bs = (IClientBroadcastStream) stream;
                IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
                if (bsScope != null && conn instanceof BaseConnection) {
                    ((BaseConnection) conn).unregisterBasicScope(bsScope);
                }
            }
            stream.close();
            scConn.deleteStreamById(streamId);
            // in case of broadcasting stream, status is sent automatically by Red5
            if (!(stream instanceof IClientBroadcastStream)) {
                StreamService.sendNetStreamStatus(conn, StatusCodes.NS_PLAY_STOP, "Stream closed by server", stream.getName(), Status.STATUS, streamId);
            }
        } else {
            log.info("Stream not found - streamId: {} connection: {}", streamId, conn.getSessionId());
        }
    } else {
        log.warn("Connection is not instance of IStreamCapableConnection: {}", conn);
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:60,代码来源:StreamService.java

示例13: closeStream

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/**
 * Close stream.
 * This method can close both IClientBroadcastStream (coming from Flash Player to Red5)
 * and ISubscriberStream (from Red5 to Flash Player).
 * Corresponding application handlers (streamSubscriberClose, etc.) are called as if close was initiated by Flash Player.
 * 
 * It is recommended to remember stream id in application handlers, ex.:
 * <pre>
 * public void streamBroadcastStart(IBroadcastStream stream) {
 * 	super.streamBroadcastStart(stream);
 * 	if (stream instanceof IClientBroadcastStream) {
 * 		int publishedStreamId = ((ClientBroadcastStream)stream).getStreamId();
 * 		Red5.getConnectionLocal().setAttribute(PUBLISHED_STREAM_ID_ATTRIBUTE, publishedStreamId);
 * 	}
 * }
 * </pre>
 * <pre>
 * public void streamPlaylistItemPlay(IPlaylistSubscriberStream stream, IPlayItem item, boolean isLive) {
 * 	super.streamPlaylistItemPlay(stream, item, isLive);
 * 	Red5.getConnectionLocal().setAttribute(WATCHED_STREAM_ID_ATTRIBUTE, stream.getStreamId());
 * }
 * </pre>
 * When stream is closed, corresponding NetStream status will be sent to stream provider / consumers.
 * Implementation is based on Red5's StreamService.close()
 * 
 * @param connection client connection
 * @param streamId stream ID (number: 1,2,...)
 */
public void closeStream(IConnection connection, int streamId) {
	if (connection instanceof IStreamCapableConnection) {
		IStreamCapableConnection scConnection = (IStreamCapableConnection) connection;
		IClientStream stream = scConnection.getStreamById(streamId);
		if (stream != null) {
			if (stream instanceof IClientBroadcastStream) {
				// this is a broadcasting stream (from Flash Player to Red5)
				IClientBroadcastStream bs = (IClientBroadcastStream) stream;
				IBroadcastScope bsScope = connection.getScope().getBroadcastScope(bs.getPublishedName());
				if (bsScope != null && connection instanceof BaseConnection) {
					((BaseConnection) connection).unregisterBasicScope(bsScope);
				}
			}
			stream.close();
			scConnection.deleteStreamById(streamId);
			// in case of broadcasting stream, status is sent automatically by Red5
			if (!(stream instanceof IClientBroadcastStream)) {
				StreamService.sendNetStreamStatus(connection, StatusCodes.NS_PLAY_STOP, "Stream closed by server", stream.getName(), Status.STATUS, streamId);
			}
		} else {
			log.info("Stream not found: streamId={}, connection={}", streamId, connection);
		}
	} else {
		log.warn("Connection is not instance of IStreamCapableConnection: {}", connection);
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:55,代码来源:StreamService.java

示例14: setClientBroadcastStream

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
/**
 * Sets the client broadcast stream
 * 
 * @param clientBroadcastStream 
 */
public void setClientBroadcastStream(IClientBroadcastStream clientBroadcastStream) {
	this.clientBroadcastStream = clientBroadcastStream;
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:9,代码来源:BroadcastScope.java

示例15: getClientBroadcastStream

import org.red5.server.api.stream.IClientBroadcastStream; //导入依赖的package包/类
public IClientBroadcastStream getClientBroadcastStream(); 
开发者ID:Red5,项目名称:red5-server-common,代码行数:2,代码来源:IBroadcastScope.java


注:本文中的org.red5.server.api.stream.IClientBroadcastStream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。