本文整理汇总了Java中org.red5.server.stream.message.RTMPMessage.build方法的典型用法代码示例。如果您正苦于以下问题:Java RTMPMessage.build方法的具体用法?Java RTMPMessage.build怎么用?Java RTMPMessage.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.red5.server.stream.message.RTMPMessage
的用法示例。
在下文中一共展示了RTMPMessage.build方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendReset
import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/**
* Send reset message
*/
private void sendReset() {
if (pullMode) {
Ping recorded = new Ping();
recorded.setEventType(Ping.RECORDED_STREAM);
recorded.setValue2(streamId);
// recorded
RTMPMessage recordedMsg = RTMPMessage.build(recorded);
doPushMessage(recordedMsg);
}
Ping begin = new Ping();
begin.setEventType(Ping.STREAM_BEGIN);
begin.setValue2(streamId);
// begin
RTMPMessage beginMsg = RTMPMessage.build(begin);
doPushMessage(beginMsg);
// reset
ResetMessage reset = new ResetMessage();
doPushMessage(reset);
}
示例2: packetReceived
import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
@Override
public void packetReceived(IBroadcastStream stream, IStreamPacket packet) {
RTMPMessage m = RTMPMessage.build((IRTMPEvent) packet, packet.getTimestamp());
try {
limiter--;
if (limiter > 1) {
streamer.pushMessage(null, m);
} else {
if (streamer != null) {
stream.removeStreamListener(this);
streamer.stop();
streamer = null;
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
示例3: sendReset
import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/**
* Send reset message
*/
private void sendReset() {
if (pullMode) {
Ping recorded = new Ping();
recorded.setEventType(Ping.RECORDED_STREAM);
recorded.setValue2(streamId);
// recorded
RTMPMessage recordedMsg = RTMPMessage.build(recorded);
doPushMessage(recordedMsg);
}
Ping begin = new Ping();
begin.setEventType(Ping.STREAM_BEGIN);
begin.setValue2(streamId);
// begin
RTMPMessage beginMsg = RTMPMessage.build(begin);
doPushMessage(beginMsg);
// reset
ResetMessage reset = new ResetMessage();
doPushMessage(reset);
}
示例4: pushVideo
import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
public void pushVideo(VideoData data, int ts) {
if (startPublish) {
if (Red5.getConnectionLocal() == null) {
Red5.setConnectionLocal(client.getConnection());
}
RTMPMessage rtmpMsg = RTMPMessage.build(data, ts);
client.publishStreamData(streamId, rtmpMsg);
}
}
示例5: sendClearPing
import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/**
* Send clear ping. Lets client know that stream has no more data to send.
*/
private void sendClearPing() {
Ping eof = new Ping();
eof.setEventType(Ping.STREAM_PLAYBUFFER_CLEAR);
eof.setValue2(streamId);
// eos
RTMPMessage eofMsg = RTMPMessage.build(eof);
doPushMessage(eofMsg);
}
示例6: sendOnPlayStatus
import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/**
* Sends an onPlayStatus message.
*
* http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/NetDataEvent.html
*
* @param code
* @param duration
* @param bytes
*/
private void sendOnPlayStatus(String code, int duration, long bytes) {
if (log.isDebugEnabled()) {
log.debug("Sending onPlayStatus - code: {} duration: {} bytes: {}", code, duration, bytes);
}
// create the buffer
IoBuffer buf = IoBuffer.allocate(102);
buf.setAutoExpand(true);
Output out = new Output(buf);
out.writeString("onPlayStatus");
ObjectMap<Object, Object> args = new ObjectMap<>();
args.put("code", code);
args.put("level", Status.STATUS);
args.put("duration", duration);
args.put("bytes", bytes);
if (StatusCodes.NS_PLAY_TRANSITION_COMPLETE.equals(code)) {
args.put("clientId", streamId);
args.put("details", currentItem.getName());
args.put("description", String.format("Transitioned to %s", currentItem.getName()));
args.put("isFastPlay", false);
}
out.writeObject(args);
buf.flip();
Notify event = new Notify(buf, "onPlayStatus");
if (lastMessageTs > 0) {
event.setTimestamp(lastMessageTs);
} else {
event.setTimestamp(0);
}
RTMPMessage msg = RTMPMessage.build(event);
doPushMessage(msg);
}
示例7: sendClearPing
import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/**
* Send clear ping. Lets client know that stream has no more data to
* send.
*/
private void sendClearPing() {
Ping eof = new Ping();
eof.setEventType(Ping.STREAM_PLAYBUFFER_CLEAR);
eof.setValue2(streamId);
// eos
RTMPMessage eofMsg = RTMPMessage.build(eof);
doPushMessage(eofMsg);
}
示例8: sendOnPlayStatus
import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/**
* Sends an onPlayStatus message.
*
* @param code
* @param duration
* @param bytes
*/
private void sendOnPlayStatus(String code, int duration, long bytes) {
IoBuffer buf = IoBuffer.allocate(255);
buf.setAutoExpand(true);
Output out = new Output(buf);
out.writeString("onPlayStatus");
Map<Object, Object> props = new HashMap<Object, Object>();
props.put("code", code);
props.put("level", "status");
props.put("duration", duration);
props.put("bytes", bytes);
if (StatusCodes.NS_PLAY_TRANSITION_COMPLETE.equals(code)) {
props.put("details", currentItem.getName());
props.put("description", String.format("Transitioned to %s", currentItem.getName()));
props.put("clientId", streamId);
props.put("isFastPlay", false);
}
out.writeMap(props, new Serializer());
buf.flip();
IRTMPEvent event = new Notify(buf);
if (lastMessageTs > 0) {
event.setTimestamp(lastMessageTs);
} else {
event.setTimestamp(0);
}
RTMPMessage msg = RTMPMessage.build(event);
doPushMessage(msg);
}
示例9: setUp
import org.red5.server.stream.message.RTMPMessage; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
protected void setUp() throws Exception {
super.setUp();
VideoData message = new VideoData(IoBuffer.allocate(100));
playBuffer = new PlayBuffer(1000);
rtmpMessage = RTMPMessage.build(message);
}