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


Java Red5.getConnectionLocal方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例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: seek

import org.red5.server.api.Red5; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void seek(int position) {
    log.trace("seek - position:{}", position);
    IConnection conn = Red5.getConnectionLocal();
    if (conn instanceof IStreamCapableConnection) {
        IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
        Number streamId = conn.getStreamId();
        IClientStream stream = streamConn.getStreamById(streamId);
        if (stream != null && stream instanceof ISubscriberStream) {
            ISubscriberStream subscriberStream = (ISubscriberStream) stream;
            try {
                subscriberStream.seek(position);
            } catch (OperationNotSupportedException err) {
                sendNSFailed(streamConn, StatusCodes.NS_SEEK_FAILED, "The stream doesn't support seeking.", stream.getName(), streamId);
            }
        }
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:19,代码来源:StreamService.java

示例8: callBWCheck

import org.red5.server.api.Red5; //导入方法依赖的package包/类
private void callBWCheck(Object payload)
{
	IConnection conn = Red5.getConnectionLocal();
	

	Map<String, Object> statsValues = new HashMap<String, Object>();
	statsValues.put("count", this.count);
	statsValues.put("sent", this.sent);
	statsValues.put("timePassed", this.timePassed);
	statsValues.put("latency", this.latency);
	statsValues.put("cumLatency", this.cumLatency);
	statsValues.put("payload", payload);
	
	if (conn instanceof IServiceCapableConnection) {
		((IServiceCapableConnection) conn).invoke("onBWCheck", new Object[]{statsValues}, this);
	}
}
 
开发者ID:Red5,项目名称:red5-examples,代码行数:18,代码来源:ServerClientDetection.java

示例9: 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

示例10: 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

示例11: createStream

import org.red5.server.api.Red5; //导入方法依赖的package包/类
/** {@inheritDoc} */
public Number createStream(Number streamId) {
    IConnection conn = Red5.getConnectionLocal();
    log.trace("createStream stream id: {} connection: {}", streamId, conn.getSessionId());
    if (conn instanceof IStreamCapableConnection) {
        try {
            if (streamId.intValue() > 0) {
                streamId = ((IStreamCapableConnection) conn).reserveStreamId(streamId);
            } else {
                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,代码行数:23,代码来源:StreamService.java

示例12: 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

示例13: publish

import org.red5.server.api.Red5; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void publish(Boolean dontStop) {
    // null is as good as false according to Boolean.valueOf() so if null, interpret as false
    if (dontStop == null || !dontStop) {
        IConnection conn = Red5.getConnectionLocal();
        if (conn instanceof IStreamCapableConnection) {
            IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
            Number streamId = conn.getStreamId();
            IClientStream stream = streamConn.getStreamById(streamId);
            if (stream instanceof IBroadcastStream) {
                IBroadcastStream bs = (IBroadcastStream) stream;
                if (bs.getPublishedName() != null) {
                    IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
                    if (bsScope != null) {
                        bsScope.unsubscribe(bs.getProvider());
                        if (conn instanceof BaseConnection) {
                            ((BaseConnection) conn).unregisterBasicScope(bsScope);
                        }
                    }
                    bs.close();
                    streamConn.deleteStreamById(streamId);
                }
            }
        }
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:27,代码来源:StreamService.java

示例14: pause

import org.red5.server.api.Red5; //导入方法依赖的package包/类
/**
 * Pause at given position. Required as "pausePlayback" can be "null" if no flag is passed by the client
 * 
 * @param pausePlayback
 *            Pause playback or not
 * @param position
 *            Pause position
 */
public void pause(Boolean pausePlayback, int position) {
    IConnection conn = Red5.getConnectionLocal();
    if (conn instanceof IStreamCapableConnection) {
        IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
        Number streamId = conn.getStreamId();
        IClientStream stream = streamConn.getStreamById(streamId);
        if (stream != null && stream instanceof ISubscriberStream) {
            ISubscriberStream subscriberStream = (ISubscriberStream) stream;
            // pausePlayback can be "null" if "pause" is called without any parameters from flash
            if (pausePlayback == null) {
                pausePlayback = !subscriberStream.isPaused();
            }
            if (pausePlayback) {
                subscriberStream.pause(position);
            } else {
                subscriberStream.resume(position);
            }
        }
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:29,代码来源:StreamService.java

示例15: pause

import org.red5.server.api.Red5; //导入方法依赖的package包/类
/**
 * Pause at given position. Required as "pausePlayback" can be "null" if no flag is passed by the
 * client
 * @param pausePlayback         Pause playback or not
 * @param position              Pause position
 */
public void pause(Boolean pausePlayback, int position) {
	IConnection conn = Red5.getConnectionLocal();
	if (conn instanceof IStreamCapableConnection) {
		IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
		int streamId = getCurrentStreamId();
		IClientStream stream = streamConn.getStreamById(streamId);
		if (stream != null && stream instanceof ISubscriberStream) {
			ISubscriberStream subscriberStream = (ISubscriberStream) stream;
			// pausePlayback can be "null" if "pause" is called without any parameters from flash
			if (pausePlayback == null) {
				pausePlayback = !subscriberStream.isPaused();
			}
			if (pausePlayback) {
				subscriberStream.pause(position);
			} else {
				subscriberStream.resume(position);
			}
		}
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:27,代码来源:StreamService.java


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