Merge remote branch 'origin/master' into poll-access

This commit is contained in:
Chad Pilkey 2012-10-02 14:58:41 +00:00
commit dea6a89dd0
23 changed files with 150 additions and 57 deletions

View File

@ -31,7 +31,7 @@ import java.lang.Long;
*/
@ThreadSafe
public class Participant implements Serializable {
private Long internalUserID;
private String internalUserID;
private String name;
private String role = "VIEWER";
private String externalUserID;
@ -39,7 +39,7 @@ public class Participant implements Serializable {
private final Map status;
private Map<String, Object> unmodifiableStatus;
public Participant(Long internalUserID, String name, String role, String externalUserID, Map<String, Object> status) {
public Participant(String internalUserID, String name, String role, String externalUserID, Map<String, Object> status) {
this.internalUserID = internalUserID;
this.name = name;
this.role = role;
@ -56,7 +56,7 @@ public class Participant implements Serializable {
return name;
}
public Long getInternalUserID() {
public String getInternalUserID() {
return internalUserID;
}

View File

@ -52,7 +52,7 @@ public class ParticipantUpdatingRoomListener implements IRoomListener{
map.put("meetingId", this.room.getName());
map.put("messageId", MessagingConstants.USER_STATUS_CHANGE_EVENT);
map.put("internalUserId", p.getInternalUserID().toString());
map.put("internalUserId", p.getInternalUserID());
map.put("status", status);
map.put("value", value.toString());
@ -67,7 +67,7 @@ public class ParticipantUpdatingRoomListener implements IRoomListener{
HashMap<String,String> map= new HashMap<String, String>();
map.put("meetingId", this.room.getName());
map.put("messageId", MessagingConstants.USER_JOINED_EVENT);
map.put("internalUserId", p.getInternalUserID().toString());
map.put("internalUserId", p.getInternalUserID());
map.put("externalUserId", p.getExternalUserID());
map.put("fullname", p.getName());
map.put("role", p.getRole());
@ -83,7 +83,7 @@ public class ParticipantUpdatingRoomListener implements IRoomListener{
HashMap<String,String> map= new HashMap<String, String>();
map.put("meetingId", this.room.getName());
map.put("messageId", MessagingConstants.USER_LEFT_EVENT);
map.put("internalUserId", p.getInternalUserID().toString());
map.put("internalUserId", p.getInternalUserID());
Gson gson= new Gson();
messagingService.send(MessagingConstants.PARTICIPANTS_CHANNEL, gson.toJson(map));

View File

@ -37,7 +37,7 @@ public class Room implements Serializable {
private static Logger log = Red5LoggerFactory.getLogger( Room.class, "bigbluebutton" );
ArrayList<String> currentPresenter = null;
private String name;
private Map <Long, Participant> participants;
private Map <String, Participant> participants;
// these should stay transient so they're not serialized in ActiveMQ messages:
//private transient Map <Long, Participant> unmodifiableMap;
@ -45,7 +45,7 @@ public class Room implements Serializable {
public Room(String name) {
this.name = name;
participants = new ConcurrentHashMap<Long, Participant>();
participants = new ConcurrentHashMap<String, Participant>();
//unmodifiableMap = Collections.unmodifiableMap(participants);
listeners = new ConcurrentHashMap<String, IRoomListener>();
}
@ -80,7 +80,7 @@ public class Room implements Serializable {
}
}
public void removeParticipant(Long userid) {
public void removeParticipant(String userid) {
boolean present = false;
Participant p = null;
synchronized (this) {
@ -99,7 +99,7 @@ public class Room implements Serializable {
}
}
public void changeParticipantStatus(Long userid, String status, Object value) {
public void changeParticipantStatus(String userid, String status, Object value) {
boolean present = false;
Participant p = null;
synchronized (this) {

View File

@ -164,7 +164,7 @@ public class RoomsManager {
log.warn("Adding participant to a non-existing room " + roomName);
}
public void removeParticipant(String roomName, Long userid) {
public void removeParticipant(String roomName, String userid) {
log.debug("Remove participant " + userid + " from " + roomName);
Room r = getRoom(roomName);
if (r != null) {
@ -179,7 +179,7 @@ public class RoomsManager {
log.warn("Removing listener from a non-existing room " + roomName);
}
public void changeParticipantStatus(String roomName, Long userid, String status, Object value) {
public void changeParticipantStatus(String roomName, String userid, String status, Object value) {
log.debug("Change participant status " + userid + " - " + status + " [" + value + "]");
Room r = getRoom(roomName);
if (r != null) {

View File

@ -61,7 +61,7 @@ public class LayoutApplication {
roomsManager = r;
}
public void lockLayout(String room, int userId, String layout) {
public void lockLayout(String room, String userId, String layout) {
roomsManager.lockLayout(room, userId, layout);
}

View File

@ -39,7 +39,7 @@ public class LayoutRoom {
private final String name;
private final Map<String, ILayoutRoomListener> listeners;
private boolean locked = false;
private int modifierId = -1;
private String modifierId = "-1";
private String currentLayout = "";
public LayoutRoom(String name) {
@ -72,7 +72,7 @@ public class LayoutRoom {
}
}
public void lockLayout(int userId, String layout) {
public void lockLayout(String userId, String layout) {
locked = true;
modifierId = userId;
currentLayout = layout;
@ -81,7 +81,7 @@ public class LayoutRoom {
public void unlockLayout() {
locked = false;
modifierId = -1;
modifierId = "-1";
currentLayout = "";
updateLayout();
}

View File

@ -83,7 +83,7 @@ public class LayoutRoomsManager {
log.warn("Removing listener to a non-existing room " + roomName);
}
public void lockLayout(String room, int userId, String layout) {
public void lockLayout(String room, String userId, String layout) {
LayoutRoom r = getRoom(room);
if (r != null) {
r.lockLayout(userId, layout);

View File

@ -36,7 +36,7 @@ public class LayoutService {
return application.currentLayout(roomName);
}
public void lock(int userId, String layout) {
public void lock(String userId, String layout) {
log.debug("Layout locked");
String roomName = Red5.getConnectionLocal().getScope().getName();
application.lockLayout(roomName, userId, layout);

View File

@ -65,7 +65,7 @@ public class ParticipantsApplication {
return false;
}
public void setParticipantStatus(String room, Long userid, String status, Object value) {
public void setParticipantStatus(String room, String userid, String status, Object value) {
roomsManager.changeParticipantStatus(room, userid, status, value);
}
@ -79,7 +79,7 @@ public class ParticipantsApplication {
return roomsManager.getParticipants(roomName);
}
public boolean participantLeft(String roomName, Long userid) {
public boolean participantLeft(String roomName, String userid) {
log.debug("Participant " + userid + " leaving room " + roomName);
if (roomsManager.hasRoom(roomName)) {
Room room = roomsManager.getRoom(roomName);
@ -92,7 +92,7 @@ public class ParticipantsApplication {
}
@SuppressWarnings("unchecked")
public boolean participantJoin(String roomName, Long userid, String username, String role, String externUserID, Map status) {
public boolean participantJoin(String roomName, String userid, String username, String role, String externUserID, Map status) {
log.debug("participant joining room " + roomName);
if (roomsManager.hasRoom(roomName)) {
Participant p = new Participant(userid, username, role, externUserID, status);

View File

@ -109,7 +109,7 @@ public class ParticipantsHandler extends ApplicationAdapter implements IApplicat
if (bbbSession == null) {
log.debug("roomLeave - session is null");
} else {
participantsApplication.participantLeft(bbbSession.getSessionName(), new Long(bbbSession.getInternalUserID()));
participantsApplication.participantLeft(bbbSession.getSessionName(), bbbSession.getInternalUserID());
}
}
@ -138,7 +138,7 @@ public class ParticipantsHandler extends ApplicationAdapter implements IApplicat
log.debug(APP + ":participantJoin - getting userid");
BigBlueButtonSession bbbSession = getBbbSession();
if (bbbSession != null) {
Long userid = new Long(bbbSession.getInternalUserID());
String userid = bbbSession.getInternalUserID();
String username = bbbSession.getUsername();
String role = bbbSession.getRole();
String room = bbbSession.getRoom();

View File

@ -37,11 +37,11 @@ public class ParticipantsService {
private ParticipantsApplication application;
@SuppressWarnings("unchecked")
public void assignPresenter(Long userid, String name, Long assignedBy) {
public void assignPresenter(String userid, String name, Long assignedBy) {
log.info("Receive assignPresenter request from client [" + userid + "," + name + "," + assignedBy + "]");
IScope scope = Red5.getConnectionLocal().getScope();
ArrayList<String> presenter = new ArrayList<String>();
presenter.add(userid.toString());
presenter.add(userid);
presenter.add(name);
presenter.add(assignedBy.toString());
ArrayList<String> curPresenter = application.getCurrentPresenter(scope.getName());
@ -49,9 +49,9 @@ public class ParticipantsService {
if (curPresenter != null){
String curUserid = (String) curPresenter.get(0);
if (! curUserid.equals(userid.toString())){
if (! curUserid.equals(userid)){
log.info("Changing the current presenter [" + curPresenter.get(0) + "] to viewer.");
application.setParticipantStatus(scope.getName(), new Long(curPresenter.get(0)), "presenter", false);
application.setParticipantStatus(scope.getName(), curPresenter.get(0), "presenter", false);
}
} else {
log.info("No current presenter. So do nothing.");
@ -90,7 +90,7 @@ public class ParticipantsService {
return participants;
}
public void setParticipantStatus(Long userid, String status, Object value) {
public void setParticipantStatus(String userid, String status, Object value) {
String roomName = Red5.getConnectionLocal().getScope().getName();
log.debug("Setting participant status " + roomName + " " + userid + " " + status + " " + value);
application.setParticipantStatus(roomName, userid, status, value);

View File

@ -25,8 +25,12 @@ package org.bigbluebutton.conference.service.presentation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bigbluebutton.conference.ClientMessage;
import org.bigbluebutton.conference.ConnectionInvokerService;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.api.Red5;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class PresentationApplication {
@ -34,6 +38,7 @@ public class PresentationApplication {
private static final String APP = "PRESENTATION";
private PresentationRoomsManager roomsManager;
private ConnectionInvokerService connInvokerService;
public boolean createRoom(String name) {
roomsManager.addRoom(new PresentationRoom(name));
@ -62,6 +67,7 @@ public class PresentationApplication {
@SuppressWarnings("unchecked")
public void sendUpdateMessage(Map message){
String room = (String) message.get("room");
if (roomsManager.hasRoom(room)){
roomsManager.sendUpdateMessage(message);
@ -118,13 +124,21 @@ public class PresentationApplication {
return null;
}
public void sendCursorUpdate(String room, Double xPercent, Double yPercent) {
public void sendCursorUpdate(String room, Double xPercent, Double yPercent) {
if (roomsManager.hasRoom(room)){
log.debug("Request to update cursor[" + xPercent + "," + yPercent + "]");
roomsManager.sendCursorUpdate(room, xPercent, yPercent);
Map<String, Object> message = new HashMap<String, Object>();
message.put("xPercent", xPercent);
message.put("yPercent", yPercent);
ClientMessage m = new ClientMessage(ClientMessage.BROADCAST, getMeetingId(), "PresentationCursorUpdateCommand", message);
connInvokerService.sendMessage(m);
return;
}
log.warn("resizeAndMoveSlide on a non-existant room " + room);
log.warn("Sending cursor update on a non-existant room " + room);
}
public void resizeAndMoveSlide(String room, Double xOffset, Double yOffset, Double widthRatio, Double heightRatio) {
@ -160,5 +174,12 @@ public class PresentationApplication {
log.debug("Done setting room manager");
}
private String getMeetingId(){
return Red5.getConnectionLocal().getScope().getName();
}
public void setConnInvokerService(ConnectionInvokerService connInvokerService) {
this.connInvokerService = connInvokerService;
}
}

View File

@ -142,11 +142,14 @@ public class PresentationEventSender implements IPresentationRoomListener {
@Override
public void sendCursorUpdate(Double xPercent, Double yPercent) {
log.debug("calling updateCursorCallback[" + xPercent + "," + yPercent + "]");
ArrayList list=new ArrayList();
list.add(xPercent);
list.add(yPercent);
so.sendMessage("updateCursorCallback", list);
// Disable. We are using connection invoke now. (ralam Oct 1, 2012).
// We'll have to convert all other messages to use conn invoke soon.
// log.debug("calling updateCursorCallback[" + xPercent + "," + yPercent + "]");
// ArrayList list=new ArrayList();
// list.add(xPercent);
// list.add(yPercent);
// so.sendMessage("updateCursorCallback", list);
}
@SuppressWarnings("unchecked")

View File

@ -31,7 +31,7 @@ public class ParticipantsEventRecorder implements IRoomListener {
public void participantJoined(Participant p) {
ParticipantJoinRecordEvent ev = new ParticipantJoinRecordEvent();
ev.setTimestamp(System.currentTimeMillis());
ev.setUserId(p.getInternalUserID().toString());
ev.setUserId(p.getInternalUserID());
ev.setName(p.getName());
ev.setMeetingId(session);
ev.setStatus(p.getStatus().toString());
@ -44,7 +44,7 @@ public class ParticipantsEventRecorder implements IRoomListener {
public void participantLeft(Participant p) {
ParticipantLeftRecordEvent ev = new ParticipantLeftRecordEvent();
ev.setTimestamp(System.currentTimeMillis());
ev.setUserId(p.getInternalUserID().toString());
ev.setUserId(p.getInternalUserID());
ev.setMeetingId(session);
recorder.record(session, ev);
@ -54,7 +54,7 @@ public class ParticipantsEventRecorder implements IRoomListener {
public void participantStatusChange(Participant p, String status, Object value) {
ParticipantStatusChangeRecordEvent ev = new ParticipantStatusChangeRecordEvent();
ev.setTimestamp(System.currentTimeMillis());
ev.setUserId(p.getInternalUserID().toString());
ev.setUserId(p.getInternalUserID());
ev.setMeetingId(session);
ev.setStatus(status);
ev.setValue(value.toString());

View File

@ -60,9 +60,8 @@
</bean>
<bean id="presentationApplication" class="org.bigbluebutton.conference.service.presentation.PresentationApplication">
<property name="roomsManager">
<ref local="presentationRoomsManager"/>
</property>
<property name="roomsManager"> <ref local="presentationRoomsManager"/></property>
<property name="connInvokerService"> <ref bean="connInvokerService"/></property>
</bean>
<bean id="presentation.service" class="org.bigbluebutton.conference.service.presentation.PresentationService">

View File

@ -186,10 +186,10 @@ package org.bigbluebutton.modules.present.business {
*
*/
public function updateCursorCallback(xPercent:Number, yPercent:Number):void{
var e:CursorEvent = new CursorEvent(CursorEvent.UPDATE_CURSOR);
e.xPercent = xPercent;
e.yPercent = yPercent;
dispatcher.dispatchEvent(e);
// var e:CursorEvent = new CursorEvent(CursorEvent.UPDATE_CURSOR);
// e.xPercent = xPercent;
// e.yPercent = yPercent;
// dispatcher.dispatchEvent(e);
}
/**

View File

@ -30,7 +30,8 @@ package org.bigbluebutton.modules.present.business
import org.bigbluebutton.modules.present.events.PresentationEvent;
import org.bigbluebutton.modules.present.managers.PresentationSlides;
import org.bigbluebutton.modules.present.managers.Slide;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.modules.present.services.MessageReceiver;
/**
* This class directly communicates with an HTTP service in order to send and recives files (slides
@ -47,10 +48,12 @@ package org.bigbluebutton.modules.present.business
private var urlLoader:URLLoader;
private var slideUri:String;
private var dispatcher:Dispatcher;
private var _messageReceiver:MessageReceiver;
public function PresentationService()
{
service = new HTTPService();
_messageReceiver = new MessageReceiver();
dispatcher = new Dispatcher();
}

View File

@ -0,0 +1,37 @@
package org.bigbluebutton.modules.present.services
{
import com.asfusion.mate.events.Dispatcher;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.core.BBB;
import org.bigbluebutton.main.model.users.IMessageListener;
import org.bigbluebutton.modules.present.events.CursorEvent;
public class MessageReceiver implements IMessageListener
{
public function MessageReceiver()
{
BBB.initConnectionManager().addMessageListener(this);
}
public function onMessage(messageName:String, message:Object):void {
// LogUtil.debug("Presentation: received message " + messageName);
switch (messageName) {
case "PresentationCursorUpdateCommand":
handlePresentationCursorUpdateCommand(message);
break;
default:
// LogUtil.warn("Cannot handle message [" + messageName + "]");
}
}
private function handlePresentationCursorUpdateCommand(message:Object):void {
var e:CursorEvent = new CursorEvent(CursorEvent.UPDATE_CURSOR);
e.xPercent = message.xPercent;
e.yPercent = message.yPercent;
var dispatcher:Dispatcher = new Dispatcher();
dispatcher.dispatchEvent(e);
}
}
}

View File

@ -0,0 +1,16 @@
package org.bigbluebutton.modules.present.services
{
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.core.BBB;
import org.bigbluebutton.main.model.users.IMessageListener;
public class MessageSender
{
public function MessageSender()
{
}
}
}

View File

@ -299,7 +299,7 @@ class ApiController {
}
UserSession us = new UserSession();
us.internalUserId = System.currentTimeMillis(); //RandomStringUtils.randomAlphanumeric(12).toLowerCase()
us.internalUserId = System.currentTimeMillis().toString(); //RandomStringUtils.randomAlphanumeric(12).toLowerCase()
us.conferencename = meeting.getName()
us.meetingID = meeting.getInternalId()
us.externUserID = externUserID

View File

@ -57,7 +57,8 @@ module BigBlueButton
# create_blank_video(15, 1000, canvas.jpg, blank-video.flv)
def self.create_blank_deskshare_video(length, rate, blank_canvas, video_out)
BigBlueButton.logger.info("Task: Creating blank deskshare video")
command = "ffmpeg -loop 1 -t #{length} -i #{blank_canvas} -loglevel fatal -v -10 -r #{rate} -vcodec flashsv #{video_out}"
loop_param = (`ffmpeg -version | grep ffmpeg | cut -d ' ' -f3`).chomp.eql?("0.11.2") ? "-loop 1" : "-loop_input"
command = "ffmpeg #{loop_param} -t #{length} -i #{blank_canvas} -loglevel fatal -v -10 -r #{rate} -vcodec flashsv #{video_out}"
BigBlueButton.execute(command)
# TODO: check for result, raise exception when there is an error
end
@ -71,7 +72,8 @@ module BigBlueButton
# create_blank_video(15, 1000, canvas.jpg, blank-video.flv)
def self.create_blank_video(length, rate, blank_canvas, video_out)
BigBlueButton.logger.info("Task: Creating blank video")
command = "ffmpeg -y -loop 1 -t #{length} -i #{blank_canvas} -loglevel fatal -v -10 -r #{rate} #{video_out}"
loop_param = (`ffmpeg -version | grep ffmpeg | cut -d ' ' -f3`).chomp.eql?("0.11.2") ? "-loop 1" : "-loop_input"
command = "ffmpeg -y #{loop_param} -t #{length} -i #{blank_canvas} -loglevel fatal -v -10 -r #{rate} #{video_out}"
BigBlueButton.execute(command)
# TODO: check for result, raise exception when there is an error
end
@ -133,7 +135,7 @@ module BigBlueButton
#Converts flv to mpg
def self.convert_flv_to_mpg(flv_video, mpg_video_out)
command = "ffmpeg -i #{flv_video} -loglevel fatal -v -10 -sameq -f mpegts #{mpg_video_out}"
command = "ffmpeg -i #{flv_video} -loglevel fatal -v -10 -sameq -f mpegts -r 29.97 #{mpg_video_out}"
BigBlueButton.logger.info("Task: Converting .flv to .mpg")
BigBlueButton.execute(command)
end

View File

@ -59,8 +59,9 @@ br{
width: 100%;
}
#webcam{
.webcam{
width: 402px;
height: 300px;
}
#video{
@ -92,6 +93,8 @@ br{
border: 1px solid #ccc;
width: 800px;
height: 600px; /* same as slide images */
position: relative;
top: -12px;
}
/* Visually hides text
@ -112,13 +115,14 @@ br{
float: right;
background: white;
height: 300px;
width: 400px;
width: 402px;
}
#chat{
margin: 0 auto;
padding: 0 10px;
border: 1px solid #ccc;
height: 300px;
}
#chat div{
padding:0px;
@ -204,3 +208,4 @@ br{
position: relative;
background: red;
}

View File

@ -239,15 +239,21 @@ function checkUrl(url)
load_video = function(){
console.log("Loading video")
document.getElementById("video").style.visibility = "hidden"
var video = document.getElementById("webcam")
video.setAttribute('src', RECORDINGS + '/video/webcams.webm');
video.setAttribute('type','video/webm');
video.setAttribute('id','webcam');
var time_manager = Popcorn("#video");
video.setAttribute('class','webcam');
video.setAttribute('id','video');
/*var time_manager = Popcorn("#video");
var pc_webcam = Popcorn("#webcam");
time_manager.on( "timeupdate", function() {
pc_webcam.currentTime( this.currentTime() );
});
});*/
video.setAttribute('data-timeline-sources', SLIDES_XML);
video.setAttribute('controls','');
video.setAttribute('autoplay','autoplay');
}
load_audio = function() {
@ -284,9 +290,10 @@ document.addEventListener( "DOMContentLoaded", function() {
chat = document.getElementById("chat")
chat.style.height = "560px";
chat.style.backgroundColor = "white";
load_audio();
}
load_audio();
//load_audio();
load_script("lib/writing.js")
generateThumbnails();