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


Java Red5类代码示例

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


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

示例1: captureScreenStop

import org.red5.server.api.Red5; //导入依赖的package包/类
private void captureScreenStop(String action) {
	try {
		log.debug("INVOKE screenSharerAction" );

		Map<String, Object> map = new HashMap<>();
		map.put(action, true);

		if (Red5.getConnectionLocal() == null) {
			Red5.setConnectionLocal(instance.getConnection());
		}
		instance.invoke("screenSharerAction", new Object[] { map }, this);
	} catch (Exception err) {
		log.error("captureScreenStop Exception: ", err);
		frame.setStatus("Exception: " + err);
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:17,代码来源:Core.java

示例2: isPublicStream

import org.red5.server.api.Red5; //导入依赖的package包/类
private boolean isPublicStream(String streamName) {
	Set<IConnection> connections = Red5.getConnectionLocal().getScope().getClientConnections();

	for (IConnection conn : connections) {
		Object connUserAuthorized = conn.getAttribute("userAuthorized");
		Object connIsPublishing = conn.getAttribute("userIsPublishing");
		Object connPublicStream = conn.getAttribute("publicStream");
		Object connStreamName = conn.getAttribute("streamName");

		if (connUserAuthorized != null && (boolean)connUserAuthorized == true &&
				connIsPublishing != null && (boolean)connIsPublishing == true &&
				connStreamName != null && connStreamName.equals(streamName) &&
				connPublicStream != null && (boolean)connPublicStream == true) {
			return true;
		}
	}
	return false;
}
 
开发者ID:nonoo,项目名称:kdrlivestream,代码行数:19,代码来源:AuthPlaySec.java

示例3: isPublishAllowed

import org.red5.server.api.Red5; //导入依赖的package包/类
@Override
public boolean isPublishAllowed(IScope scope, String name, String mode) {
	IConnection conn = Red5.getConnectionLocal();
	Object userAuthorized = conn.getAttribute("userAuthorized");
	Object publishAllowed = conn.getAttribute("publishAllowed");
	Object userName = conn.getAttribute("userName");

	if (userAuthorized == null || (boolean)userAuthorized != true) {
		log.info("user is not authorized at all, not allowing to publish, closing connection");
		return false;
	}
	
	if (publishAllowed == null || (boolean)publishAllowed != true)
		return false;

	// Now we know what stream the client wants to access, so storing it as a connection attribute.
	conn.setAttribute("streamName", name);

	if (userName != null)
		log.info("user " + (String)userName + " authorized to publish stream " + name + ": " + (publishAllowed.equals(true) ? "yes" : "no"));

	conn.setAttribute("userIsPublishing", true);
	
	return publishAllowed.equals(true);
}
 
开发者ID:nonoo,项目名称:kdrlivestream,代码行数:26,代码来源:AuthPubSec.java

示例4: sendCursorStatus

import org.red5.server.api.Red5; //导入依赖的package包/类
public void sendCursorStatus() {
	try {
		Point mouseP = MouseInfo.getPointerInfo().getLocation();

		float scaleFactor = (1.0f * dim.getResizeX()) / dim.getSpinnerWidth();

		// Real size: Real mouse position = Resize : X
		int x = (int)((mouseP.getX() - dim.getSpinnerX()) * scaleFactor);
		int y = (int)((mouseP.getY() - dim.getSpinnerY()) * scaleFactor);

		if (instance.getConnection() != null) {
			if (Red5.getConnectionLocal() == null) {
				Red5.setConnectionLocal(instance.getConnection());
			}
			instance.invoke("setNewCursorPosition", new Object[] { x, y }, this);
		}
	} catch (NullPointerException npe) {
		//noop
	} catch (Exception err) {
		frame.setStatus("Exception: " + err);
		log.error("[sendCursorStatus]", err);
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:24,代码来源:Core.java

示例5: sendMessageWithClientWithSyncObject

import org.red5.server.api.Red5; //导入依赖的package包/类
/**
 * wrapper method
 *
 * @param newMessage - message being sent
 * @param sync - send self
 * @return 1 in case of success, -1 otherwise
 */
public int sendMessageWithClientWithSyncObject(Object newMessage, boolean sync) {
	try {
		IConnection current = Red5.getConnectionLocal();
		StreamClient currentClient = sessionManager.get(IClientUtil.getId(current.getClient()));

		Map<String, Object> hsm = new HashMap<>();
		hsm.put("client", currentClient);
		hsm.put("message", newMessage);

		//Sync to all users of current scope
		sendMessageToCurrentScope("sendVarsToMessageWithClient", hsm, sync);

	} catch (Exception err) {
		_log.error("[sendMessageWithClient] ", err);
		return -1;
	}
	return 1;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:26,代码来源:ScopeApplicationAdapter.java

示例6: updateSipTransport

import org.red5.server.api.Red5; //导入依赖的package包/类
public synchronized int updateSipTransport() {
	_log.debug("-----------  updateSipTransport");
	IConnection current = Red5.getConnectionLocal();
	StreamClient client = sessionManager.get(IClientUtil.getId(current.getClient()));
	Long roomId = client.getRoomId();
	Integer count = getSipConferenceMembersNumber(roomId);
	String newNumber = getSipTransportLastname(count);
	_log.debug("getSipConferenceMembersNumber: " + newNumber);
	if (!newNumber.equals(client.getLastname())) {
		Client cl = getApp().getOmClientBySid(client.getSid());
		cl.getUser().setLastname(newNumber);
		client.setLastname(newNumber);
		sessionManager.update(client);
		_log.debug("updateSipTransport: {}, {}, {}, {}, {}", new Object[] { client.getUid(), client.getRoomId(),
				client.getFirstname(), client.getLastname(), client.getAvsettings() });
		WebSocketHelper.sendRoom(new TextRoomMessage(client.getRoomId(), client, RoomMessage.Type.rightUpdated, client.getUid()));
		sendMessageWithClient(new String[] { "personal", client.getFirstname(), client.getLastname() });
	}
	return count != null && count > 0 ? count - 1 : 0;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:21,代码来源:ScopeApplicationAdapter.java

示例7: login

import org.red5.server.api.Red5; //导入依赖的package包/类
private Map<String, Object> login(User u, Map<String, Object> result) {
	if (u != null) {
		IConnection conn = Red5.getConnectionLocal();
		Sessiondata sd = sessionDao.create(u.getId(), u.getLanguageId());
		StreamClient c = create(u, sd);
		c.setScope(conn.getScope().getName());
		sessionManager.add(c);
		IClientUtil.init(conn.getClient(), c.getUid(), false);

		add(result, "sid", sd.getSessionId());
		add(result, "publicSid", c.getUid());
		add(result, PARAM_STATUS, 0);
		add(result, PARAM_USER_ID, u.getId());
		add(result, "firstname", u.getFirstname());
		add(result, "lastname", u.getLastname());
		add(result, "login", u.getLogin());
		add(result, "email", u.getAddress() == null ? "" : u.getAddress().getEmail());
		add(result, "language", u.getLanguageId());
		add(result, "version", getVersion());
	}
	return result;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:23,代码来源:MobileService.java

示例8: updateAvMode

import org.red5.server.api.Red5; //导入依赖的package包/类
public Map<String, Object> updateAvMode(String avMode, String width, String height, Integer interviewPodId) {
	IConnection current = Red5.getConnectionLocal();
	StreamClient c = sessionManager.get(IClientUtil.getId(current.getClient()));
	c.setAvsettings(avMode);
	if (!"n".equals(avMode)) {
		c.setBroadcastId(UUID.randomUUID().toString());
		c.setBroadcasting(true);
	}
	c.setWidth(Double.valueOf(width).intValue());
	c.setHeight(Double.valueOf(height).intValue());
	if (interviewPodId > 0) {
		c.setInterviewPodId(interviewPodId);
	}
	sessionManager.update(c);
	Map<String, Object> hsm = new HashMap<>();
	hsm.put("client", c);
	hsm.put("message", new String[]{"avsettings", "0", avMode});
	Map<String, Object> result = new HashMap<>();
	if (!"n".equals(avMode)) {
		result.put("broadcastId", c.getBroadcastId());
	}

	scopeAdapter.sendMessageToCurrentScope("sendVarsToMessageWithClient", hsm, true, false);
	return result;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:26,代码来源:MobileService.java

示例9: sendChatMessage

import org.red5.server.api.Red5; //导入依赖的package包/类
public void sendChatMessage(String msg) {
	IConnection current = Red5.getConnectionLocal();
	StreamClient c = sessionManager.get(IClientUtil.getId(current.getClient()));

	ChatMessage m = new ChatMessage();
	m.setMessage(msg);
	m.setSent(new Date());
	User u = userDao.get(c.getUserId());
	m.setFromUser(u);
	Room r = roomDao.get(c.getRoomId());
	m.setToRoom(r);
	m.setNeedModeration(r.isChatModerated() && !isModerator(c));
	chatDao.update(m);
	FastDateFormat fmt = FormatHelper.getDateTimeFormat(u);
	sendChatMessage(c, m, fmt);
	WebSocketHelper.sendRoom(m, WebSocketHelper.getMessage(u, Arrays.asList(m), null));
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:18,代码来源:MobileService.java

示例10: getRoomChatHistory

import org.red5.server.api.Red5; //导入依赖的package包/类
public List<Map<String, Object>> getRoomChatHistory() {
	List<Map<String,Object>> myChatList = new ArrayList<>();
	try {
		IConnection current = Red5.getConnectionLocal();
		StreamClient c = sessionManager.get(IClientUtil.getId(current.getClient()));
		Long roomId = c.getRoomId();

		log.debug("GET CHATROOM: " + roomId);

		Room r = roomDao.get(roomId);
		User u = userDao.get(c.getUserId());
		FastDateFormat fmt = FormatHelper.getDateTimeFormat(u);
		for (ChatMessage m : chatDao.getRoom(roomId, 0, 30, !r.isChatModerated() || isModerator(c))) {
			myChatList.add(encodeChatMessage(m, fmt));
		}

	} catch (Exception err) {
		log.error("[getRoomChatHistory] ",err);
	}
	return myChatList;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:22,代码来源:MobileService.java

示例11: streamBroadcastClose

import org.red5.server.api.Red5; //导入依赖的package包/类
@Override
public void streamBroadcastClose(IBroadcastStream stream) {
	// TODO Auto-generated method stub
	log.debug("Inside streamBroadcastClose");
	
	String streamFullName = DVRUtils.getStreamFullName(stream.getPublishedName());
	IDVRStream dvrStream = this.getStream(streamFullName, false);
	
	if(dvrStream != null)
	{
		IConnection conn = Red5.getConnectionLocal();
		dvrStream.unpublish(conn);
	}
	
	super.streamBroadcastClose(stream);
}
 
开发者ID:rajdeeprath,项目名称:red5-server-apps,代码行数:17,代码来源:Application.java

示例12: callBWCheck

import org.red5.server.api.Red5; //导入依赖的package包/类
private void callBWCheck(Object payload) {
    if (log.isTraceEnabled()) {
        log.trace("callBWCheck: {}", payload);
    } else {
        log.debug("callBWCheck");
    }
    IConnection conn = Red5.getConnectionLocal();
    Map<String, Object> statsValues = new HashMap<String, Object>();
    statsValues.put("count", packetsReceived.get());
    statsValues.put("sent", packetsSent.get());
    statsValues.put("timePassed", timePassed);
    statsValues.put("latency", latency);
    statsValues.put("cumLatency", cumLatency);
    statsValues.put("payload", payload);
    if (conn instanceof IServiceCapableConnection) {
        log.debug("Invoking onBWCheck on the client");
        // increment sent counter
        packetsSent.incrementAndGet();
        // invoke on the client
        ((IServiceCapableConnection) conn).invoke("onBWCheck", new Object[] { statsValues }, this);
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:23,代码来源:ServerClientDetection.java

示例13: callBWDone

import org.red5.server.api.Red5; //导入依赖的package包/类
private void callBWDone() {
    log.debug("callBWDone");
    IConnection conn = Red5.getConnectionLocal();
    Map<String, Object> statsValues = new HashMap<String, Object>();
    statsValues.put("kbitDown", kbitDown);
    statsValues.put("deltaDown", deltaDown);
    statsValues.put("deltaTime", deltaTime);
    statsValues.put("latency", latency);
    if (conn instanceof IServiceCapableConnection) {
        log.debug("Invoking onBWDone on the client");
        // invoke on the client
        ((IServiceCapableConnection) conn).invoke("onBWDone", new Object[] { statsValues });
        // adjust bandwidth to mbit/s
        int mbits = (int) ((kbitDown / 1000d) * 1000000);
        log.debug("Setting bandwidth to {} mbit/s", mbits);
        // tell the flash player how fast we want data and how fast we shall send it
        conn.setBandwidth(mbits);
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:20,代码来源:ServerClientDetection.java

示例14: createStream

import org.red5.server.api.Red5; //导入依赖的package包/类
/** {@inheritDoc} */
public Number createStream() {
    IConnection conn = Red5.getConnectionLocal();
    log.trace("createStream connection: {}", conn.getSessionId());
    if (conn instanceof IStreamCapableConnection) {
        try {
            Number streamId = ((IStreamCapableConnection) conn).reserveStreamId();
            if (log.isTraceEnabled()) {
                log.trace("Stream id: {} created for {}", streamId, conn.getSessionId());
            }
            return streamId;
        } catch (IndexOutOfBoundsException e) {
            log.error("Unable to create stream", e);
            return -1;
        }
    }
    return -1;
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:19,代码来源:StreamService.java

示例15: initStream

import org.red5.server.api.Red5; //导入依赖的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


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