• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Notify类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onCommand

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
/**
 * @param command - command to be processed
 */
protected void onCommand(ICommand command) {
	if (!(command instanceof Notify)) {
		return;
	}
	Notify invoke = (Notify)command;
	if (invoke.getType() == IEvent.Type.STREAM_DATA) {
		return;
	}

	String method = invoke.getCall().getServiceMethodName();
	if ("screenSharerAction".equals(method)) {
		Object[] args = invoke.getCall().getArguments();
		if (args != null && args.length > 0) {
			@SuppressWarnings("unchecked")
			Map<String, Object> params = (Map<String, Object>)args[0];
			if (bool(params.get("stopPublishing"))) {
				stopPublishing();
			}
			if (params.containsKey("error")) {
				frame.setStatus("" + params.get("error"));
			}
		}
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:28,代码来源:Core.java


示例2: handleParameters

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
/**
 * Sets incoming connection parameters and / or returns encoded parameters for use in a call.
 * 
 * @param in
 * @param notify
 * @param input
 * @return parameters array
 */
private Object[] handleParameters(IoBuffer in, Notify notify, Input input) {
    Object[] params = new Object[] {};
    List<Object> paramList = new ArrayList<>();
    final Object obj = Deserializer.deserialize(input, Object.class);
    if (obj instanceof Map) {
        // Before the actual parameters we sometimes (connect) get a map of parameters, this is usually null, but if set should be
        // passed to the connection object.
        @SuppressWarnings("unchecked")
        final Map<String, Object> connParams = (Map<String, Object>) obj;
        notify.setConnectionParams(connParams);
    } else if (obj != null) {
        paramList.add(obj);
    }
    while (in.hasRemaining()) {
        paramList.add(Deserializer.deserialize(input, Object.class));
    }
    params = paramList.toArray();
    if (log.isDebugEnabled()) {
        log.debug("Num params: {}", paramList.size());
        for (int i = 0; i < params.length; i++) {
            log.debug(" > {}: {}", i, params[i]);
        }
    }
    return params;
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:34,代码来源:RTMPProtocolDecoder.java


示例3: packetReceived

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
public void packetReceived(IBroadcastStream arg0, IStreamPacket packet) {

		if (done) {
			arg0.removeStreamListener(this);
			return;
		}

		messages = Red5.getConnectionLocal().getWrittenMessages() + Red5.getConnectionLocal().getReadMessages();

		bytesUp = Red5.getConnectionLocal().getReadBytes();

		bytesDown = Red5.getConnectionLocal().getWrittenBytes();

		if (packet instanceof Notify) {

			endpoint().invoke("onBWChunk", new Object[] { chunk });
			chunks++;
			//  Input reader = new Input(((Notify)packet).getData()); 
			//  reader.readDataType();//string
			//  String  method=reader.readString(null);
			//  reader.readDataType();//object
			//  Map invokeData=  (Map) reader.readMap(new Deserializer(), null);            
			//  System.out.println(method+""+invokeData.get("data").toString());	
		}
	}
 
开发者ID:Red5,项目名称:red5-rtsp-restreamer,代码行数:26,代码来源:BandwidthChecker.java


示例4: getMetaDataEvent

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
public Notify getMetaDataEvent() {

		IoBuffer buf = IoBuffer.allocate(1024);
		buf.setAutoExpand(true);
		Output out = new Output(buf);
		out.writeString("onMetaData");

		Map<Object, Object> props = new HashMap<Object, Object>();
		props.put("width", 160);
		props.put("height", 120);
		props.put("framerate", 15);
		props.put("videocodecid", 7);
		props.put("canSeekToEnd", false);
		out.writeMap(props);
		buf.flip();

		return new Notify(buf);
	}
 
开发者ID:Red5,项目名称:red5-rtsp-restreamer,代码行数:19,代码来源:AxisTest.java


示例5: onStreamEvent

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
@Override
public void onStreamEvent(Notify notify) {
    log.debug("onStreamEvent: {}", notify);
    ObjectMap<?, ?> map = (ObjectMap<?, ?>) notify.getCall().getArguments()[0];
    String code = (String) map.get("code");
    log.debug("<:{}", code);
    if (StatusCodes.NS_PUBLISH_START.equals(code)) {
        setState(StreamState.PUBLISHED);
        IMessage message = null;
        while ((message = frameBuffer.poll()) != null) {
            rtmpClient.publishStreamData(streamId, message);
        }
    } else if (StatusCodes.NS_UNPUBLISHED_SUCCESS.equals(code)) {
        setState(StreamState.UNPUBLISHED);
    }
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:17,代码来源:StreamingProxy.java


示例6: testDecodeBufferExTS

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
@Test
public void testDecodeBufferExTS() {
    //log.debug("\testDecodeBufferExTS");
    RTMPProtocolDecoder dec = new RTMPProtocolDecoder();
    RTMPConnection conn = new RTMPMinaConnection();
    Red5.setConnectionLocal(conn);
    RTMP rtmp = conn.getState();
    rtmp.setState(RTMP.STATE_CONNECTED);
    // lastHeader: Header [streamId=1, channelId=4, dataType=18, timerBase=0, timerDelta=0, size=309, extended=false]
    // get the local decode state
    RTMPDecodeState state = conn.getDecoderState();
    // meta and audio 4x chunks
    IoBuffer in = IoBuffer.wrap(IOUtils.hexStringToByteArray("04000000000135120100000002000d40736574446174614672616d6502000a6f6e4d65746144617461080000000d00086475726174696f6e0040d518000000000000057769647468004064000000000000000668656967687400405e000000000000000d766964656f64617461726174650040686a000000000000096672616d657261746500403900000000c40000000c766964656f636f6465636964004000000000000000000d617564696f6461746172617465000000000000000000000f617564696f73616d706c65726174650040d5888000000000000f617564696f73616d706c6573697a65004030000000000000000673746572656f0100000c617564696f636f6465636964004000c40000000000000007656e636f64657202000d4c61766635362e31352e313032000866696c6573697a650000000000000000000000090400000000006908010000002afff340c400104002e62d4110009080200830107ea04cfa810710e0987f820ec130fc401897c1c0c70ff502008020eea04c1f0fe7fcb9fc10ff90d107c1f82008021feb07c1c04010041c20f89c1fff6b6edad93d99d8da6cd42a08e459095589d4b5fb9a4e679a1f4400001a00006a082afff342c41a19c91f225d89300055a47640c62cee7ccc85c08c42cadb6b56daebe65989f78c3ef3cfbd694ac0c34aa855ee0598a031f0a0686212d43631a4c59a926383c2d5201c5e9b7377"));
    Packet packet = null;
    do {
        packet = dec.decodePacket(conn, state, in);
    } while (packet == null);
    assertNotNull(packet);
    assertTrue(packet.getMessage() instanceof Notify);
    do {
        packet = dec.decodePacket(conn, state, in);
    } while (packet == null);
    assertNotNull(packet);
    assertTrue(packet.getMessage() instanceof AudioData);
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:26,代码来源:RTMPClientProtocolDecoderTest.java


示例7: onCommand

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void onCommand(RTMPConnection conn, Channel channel, Header header, Notify notify) {
    super.onCommand(conn, channel, header, notify);
    System.out.println("onInvoke, header = " + header.toString());
    System.out.println("onInvoke, notify = " + notify.toString());
    Object obj = notify.getCall().getArguments().length > 0 ? notify.getCall().getArguments()[0] : null;
    if (obj instanceof Map) {
        Map<String, String> map = (Map<String, String>) obj;
        String code = map.get("code");
        if (StatusCodes.NS_PLAY_STOP.equals(code)) {
            synchronized (RTMPTSClientTest.class) {
                finished = true;
                RTMPTSClientTest.class.notifyAll();
            }
            disconnect();
            System.out.println("Disconnected");
        }
    }

}
 
开发者ID:Red5,项目名称:red5-client,代码行数:21,代码来源:RTMPTSClientTest.java


示例8: onCommand

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void onCommand(RTMPConnection conn, Channel channel, Header header, Notify notify) {
    super.onCommand(conn, channel, header, notify);
    System.out.println("onInvoke, header = " + header.toString());
    System.out.println("onInvoke, notify = " + notify.toString());
    Object obj = notify.getCall().getArguments().length > 0 ? notify.getCall().getArguments()[0] : null;
    if (obj instanceof Map) {
        Map<String, String> map = (Map<String, String>) obj;
        String code = map.get("code");
        if (StatusCodes.NS_PLAY_STOP.equals(code)) {
            synchronized (RTMPTClientTest.class) {
                finished = true;
                RTMPTClientTest.class.notifyAll();
            }
            disconnect();
            System.out.println("Disconnected");
        }
    }

}
 
开发者ID:Red5,项目名称:red5-client,代码行数:21,代码来源:RTMPTClientTest.java


示例9: handlePendingCallResult

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
/**
 * Handler for pending call result. Dispatches results to all pending call
 * handlers.
 * 
 * @param conn
 *            Connection
 * @param invoke
 *            Pending call result event context
 */
protected void handlePendingCallResult(RTMPConnection conn, Notify invoke) {
	final IServiceCall call = invoke.getCall();
	final IPendingServiceCall pendingCall = conn.retrievePendingCall(invoke.getInvokeId());
	if (pendingCall != null) {
		// The client sent a response to a previously made call.
		Object[] args = call.getArguments();
		if (args != null && args.length > 0) {
			// TODO: can a client return multiple results?
			pendingCall.setResult(args[0]);
		}
		Set<IPendingServiceCallback> callbacks = pendingCall.getCallbacks();
		if (!callbacks.isEmpty()) {
			HashSet<IPendingServiceCallback> tmp = new HashSet<IPendingServiceCallback>();
			tmp.addAll(callbacks);
			for (IPendingServiceCallback callback : tmp) {
				try {
					callback.resultReceived(pendingCall);
				} catch (Exception e) {
					log.error("Error while executing callback {}", callback, e);
				}
			}
		}
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:34,代码来源:BaseRTMPHandler.java


示例10: encodeNotifyOrInvoke

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
@Override
protected void encodeNotifyOrInvoke(IoBuffer out, Notify invoke, RTMP rtmp) {
	// if we get an InsufficientBW message for the client, we'll reduce the
	// base tolerance and set drop live to true
	final IServiceCall call = invoke.getCall();
	if ("onStatus".equals(call.getServiceMethodName()) && call.getArguments().length >= 1) {
		Object arg0 = call.getArguments()[0];
		if ("NetStream.Play.InsufficientBW".equals(((Status) arg0).getCode())) {
			long baseT = getBaseTolerance();
			try {
				// drop the tolerances by half but not less than 500
				setBaseTolerance(Math.max(baseT / 2, 500));
			} catch (Exception e) {
				log.debug("Problem setting base tolerance: {}", e.getMessage());
			}
			setDropLiveFuture(true);
		}
	}
	super.encodeNotifyOrInvoke(out, invoke, rtmp);
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:21,代码来源:RTMPTProtocolEncoder.java


示例11: onStreamEvent

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
@Override
public void onStreamEvent(Notify notify) {
	log.debug( "onStreamEvent " + notify );

	@SuppressWarnings("rawtypes")
	ObjectMap map = (ObjectMap) notify.getCall().getArguments()[0];
	String code = (String) map.get("code");

	if (StatusCodes.NS_PUBLISH_START.equals(code)) {
		log.debug( "onStreamEvent Publish start" );
		getCapture().setStartPublish(true);
		setReadyToRecord(true);
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:15,代码来源:Core.java


示例12: notifyBroadcastStart

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
/**
 * Notifies handler on stream broadcast start
 */
private void notifyBroadcastStart() {
    IStreamAwareScopeHandler handler = getStreamAwareHandler();
    if (handler != null) {
        try {
            handler.streamBroadcastStart(this);
        } catch (Throwable t) {
            log.error("Error in notifyBroadcastStart", t);
        }
    }
    // send metadata for creation and start dates
    IoBuffer buf = IoBuffer.allocate(256);
    buf.setAutoExpand(true);
    Output out = new Output(buf);
    out.writeString("onMetaData");
    Map<Object, Object> params = new HashMap<>();
    Calendar cal = GregorianCalendar.getInstance();
    cal.setTimeInMillis(creationTime);
    params.put("creationdate", ZonedDateTime.ofInstant(cal.toInstant(), ZoneId.of("UTC")).format(DateTimeFormatter.ISO_INSTANT));
    cal.setTimeInMillis(startTime);
    params.put("startdate", ZonedDateTime.ofInstant(cal.toInstant(), ZoneId.of("UTC")).format(DateTimeFormatter.ISO_INSTANT));
    if (log.isDebugEnabled()) {
        log.debug("Params: {}", params);
    }
    out.writeMap(params);
    buf.flip();
    Notify notify = new Notify(buf);
    notify.setAction("onMetaData");
    notify.setHeader(new Header());
    notify.getHeader().setDataType(Notify.TYPE_STREAM_METADATA);
    notify.getHeader().setStreamId(0);
    notify.setTimestamp(0);
    dispatchEvent(notify);
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:37,代码来源:ClientBroadcastStream.java


示例13: sendOnPlayStatus

import org.red5.server.net.rtmp.event.Notify; //导入依赖的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);
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:41,代码来源:PlayEngine.java


示例14: getMetaData

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
/**
 * Returns a copy of the metadata for the associated stream, if it exists.
 * 
 * @return stream meta data
 */
public Notify getMetaData() {
    Notify md = metaData.get();
    if (md != null) {
        try {
            return md.duplicate();
        } catch (Exception e) {
        }
    }
    return md;
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:16,代码来源:AbstractStream.java


示例15: getMetaData

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
public Notify getMetaData() {
	if (_metaDataEvent != null) {

		return _metaDataEvent;
	}
	return null;
}
 
开发者ID:Red5,项目名称:red5-rtsp-restreamer,代码行数:8,代码来源:ICYStream.java


示例16: onCommand

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void onCommand(RTMPConnection conn, Channel channel, Header header, Notify notify) {
    super.onCommand(conn, channel, header, notify);
    System.out.println("onInvoke - header: " + header.toString() + " notify: " + notify.toString());
    Object obj = notify.getCall().getArguments().length > 0 ? notify.getCall().getArguments()[0] : null;
    if (obj instanceof Map) {
        Map<String, String> map = (Map<String, String>) obj;
        String code = map.get("code");
        if (StatusCodes.NS_PLAY_STOP.equals(code)) {
            finished = true;
            disconnect();
            System.out.println("Disconnected");
        }
    }
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:16,代码来源:ClientTest.java


示例17: sendOnPlayStatus

import org.red5.server.net.rtmp.event.Notify; //导入依赖的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);
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:36,代码来源:PlayEngine.java


示例18: encodeNotifyOrInvoke

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
/**
 * Encode notification event.
 *
 * @param invoke            Notification event
 * @return                  Encoded event data
 */
protected IoBuffer encodeNotifyOrInvoke(Notify invoke, RTMP rtmp) {
	IoBuffer out = IoBuffer.allocate(1024);
	out.setAutoExpand(true);
	encodeNotifyOrInvoke(out, invoke, rtmp);
	return out;
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:13,代码来源:RTMPProtocolEncoder.java


示例19: onStreamEvent

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
@Override
public void onStreamEvent(Notify notify) {
	//no-op
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:5,代码来源:RTMPClientPublish.java


示例20: onStreamEvent

import org.red5.server.net.rtmp.event.Notify; //导入依赖的package包/类
@Override
public void onStreamEvent(Notify notify) {
	// no-op
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:5,代码来源:LoadTestRtmpClient.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ServiceDiscovery类代码示例发布时间:2022-05-23
下一篇:
Java Configuration类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap