Commit 4e4ec0b4 authored by Dele Olajide's avatar Dele Olajide Committed by dele

Jitsi Videobridge - version 1.2.1

Update Spark plugin and add source code to project

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13964 b35dd754-fafc-0310-a699-88a17e54d16e
parent a1ab14c3
......@@ -44,6 +44,12 @@
Jitsi Video Bridge Plugin Changelog
</h1>
<p><b>1.2.1</b> -- Feb 17th, 2014</p>
<ul>
<li>Updated Spark plugin and added source code to project files</li>
</ul>
<p><b>1.2</b> -- Feb 15th, 2014</p>
<ul>
......
......@@ -6,7 +6,7 @@
<licenseType>LGPL</licenseType>
<minServerVersion>3.9.0</minServerVersion>
<name>Jitsi Video Bridge</name>
<version>1.2</version>
<version>1.2.1</version>
<adminconsole>
<tab id="tab-server">
......
......@@ -62,9 +62,7 @@ multiuser video communication. Unlike the expensive dedicated hardware videobrid
Jitsi Videobridge does not mix the video channels into a composite video stream,
but only relays the received video channels to all call participants.
Therefore, while it does need to run on a server with good network bandwidth,
CPU horsepower is not that critical for performance.
It includes the OfMeet video conference application using WebRTC as well as a simple Spark plugin.
CPU horsepower is not that critical for performance. It also includes some useful web conference applications.
</p>
<h2>Known Issues</h2>
......
/**
* $RCSfile: ,v $
* $Revision: $
* $Date: $
*
* Copyright (C) 2004-2010 Jive Software. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* <b>Bare Bones Browser Launch for Java</b><br>
* Utility class to open a web page from a Swing application
* in the user's default browser.<br>
* Supports: Mac OS X, GNU/Linux, Unix, Windows XP/Vista/7<br>
* Example Usage:<code><br> &nbsp; &nbsp;
* String url = "http://www.google.com/";<br> &nbsp; &nbsp;
* BareBonesBrowserLaunch.openURL(int width, int height, String url, String title);<br></code>
* Latest Version: <a href="http://www.centerkey.com/java/browser/">www.centerkey.com/java/browser</a><br>
* Author: Dem Pilafian<br>
* Public Domain Software -- Free to Use as You Like
* @version 3.1, June 6, 2010
*/
package org.jivesoftware.spark.plugin.jitsivideobridge;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import org.jivesoftware.spark.SparkManager;
import org.jivesoftware.spark.component.browser.*;
import org.jivesoftware.spark.util.log.*;
public class BareBonesBrowserLaunch {
static final String[] browsers = { "google-chrome", "firefox", "opera","epiphany", "konqueror", "conkeror", "midori", "kazehakase", "mozilla" };
static final String errMsg = "Error attempting to launch web browser";
/**
* Opens the specified web page in the user's default browser
* @param url A web address (URL) of a web page (ex: "http://www.google.com/")
*/
public static void openURL(String url)
{
Log.warning("BareBonesBrowserLaunch.openURL: " + url);
String osName = System.getProperty("os.name").toLowerCase();
try {
if (osName.startsWith("mac os"))
{
Class.forName("com.apple.eio.FileManager").getDeclaredMethod("openURL", new Class[] {String.class}).invoke(null, new Object[] {url});
} else if (osName.startsWith("windows")) {
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
} else { //assume Unix or Linux
String browser = null;
for (String b : browsers)
{
if (browser == null && Runtime.getRuntime().exec(new String[] {"which", b}).getInputStream().read() != -1)
{
Runtime.getRuntime().exec(new String[] {browser = b, url});
}
}
if (browser == null)
{
throw new Exception(Arrays.toString(browsers));
}
}
} catch (Exception e) {
Log.warning("BareBonesBrowserLaunch.openURL: error " + e);
JOptionPane.showMessageDialog(null, errMsg + "\n" + e.toString());
}
}
}
/**
* $RCSfile: ,v $
* $Revision: $
* $Date: $
*
* Copyright (C) 2004-2010 Jive Software. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.spark.plugin.jitsivideobridge;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import org.jivesoftware.spark.SparkManager;
import org.jivesoftware.spark.component.RolloverButton;
import org.jivesoftware.spark.ui.ChatRoom;
import org.jivesoftware.spark.util.*;
import org.jivesoftware.spark.util.log.*;
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.packet.*;
public class ChatRoomDecorator
{
public RolloverButton jitsivideobridgeButton;
public ChatRoom room;
private final String url;
public ChatRoomDecorator(final ChatRoom room, final String url)
{
this.room = room;
this.url = url;
ClassLoader cl = getClass().getClassLoader();
ImageIcon jitsivideobridgeIcon = new ImageIcon(cl.getResource("images/jitsi_logo16x16.png"));
jitsivideobridgeButton = new RolloverButton(jitsivideobridgeIcon);
jitsivideobridgeButton.setToolTipText(GraphicUtils.createToolTip("Jitsi Videobridge"));
final String roomId = getNode(room.getRoomname());
final String sessionID = roomId + "-" + SparkManager.getConnection().getConnectionID();
final String nickname = getNode(org.jivesoftware.smack.util.StringUtils.parseBareAddress(SparkManager.getSessionManager().getJID()));
jitsivideobridgeButton.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
String newUrl;
if ("groupchat".equals(room.getChatType().toString()))
{
newUrl = url + "r=" + roomId;
sendInvite(room.getRoomname(), newUrl, Message.Type.groupchat);
} else {
newUrl = url + "r=" + sessionID;
sendInvite(room.getRoomname(), newUrl, Message.Type.chat);
}
BareBonesBrowserLaunch.openURL(newUrl);
}
});
room.getEditorBar().add(jitsivideobridgeButton);
}
public void finished()
{
Log.warning("ChatRoomDecorator: finished " + room.getRoomname());
}
private String getNode(String jid)
{
String node = jid;
int pos = node.indexOf("@");
if (pos > -1)
node = jid.substring(0, pos);
return node;
}
private void sendInvite(String jid, String url, Message.Type type)
{
Message message2 = new Message();
message2.setTo(jid);
message2.setType(type);
message2.setBody(url);
SparkManager.getConnection().sendPacket(message2);
}
}
/**
* $RCSfile: ,v $
* $Revision: $
* $Date: $
*
* Copyright (C) 2004-2010 Jive Software. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.spark.plugin.jitsivideobridge;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.io.*;
import java.net.*;
import org.jivesoftware.Spark;
import org.jivesoftware.spark.*;
import org.jivesoftware.spark.component.*;
import org.jivesoftware.spark.component.browser.*;
import org.jivesoftware.spark.plugin.*;
import org.jivesoftware.spark.ui.rooms.*;
import org.jivesoftware.spark.ui.*;
import org.jivesoftware.spark.util.*;
import org.jivesoftware.smack.*;
import org.jivesoftware.spark.util.log.*;
public class JitsiVideobridgePlugin implements Plugin, ChatRoomListener
{
private org.jivesoftware.spark.ChatManager chatManager;
private ImageIcon jitsivideobridgeIcon;
private String protocol = "https";
private String server = null;
private String port = "7443";
private String url = null;
private static File pluginsettings = new File(System.getProperty("user.home") + System.getProperty("file.separator") + "Spark" + System.getProperty("file.separator") + "jitsivideobridge.properties");
private Map<String, ChatRoomDecorator> decorators = new HashMap<String, ChatRoomDecorator>();
public JitsiVideobridgePlugin()
{
ClassLoader cl = getClass().getClassLoader();
jitsivideobridgeIcon = new ImageIcon(cl.getResource("images/jitsi_logo16x16.png"));
}
public void initialize()
{
chatManager = SparkManager.getChatManager();
server = SparkManager.getSessionManager().getServerAddress();
url = protocol + "://" + server + ":" + port + "/jitsi/apps/ofmeet/?";
Properties props = new Properties();
if (pluginsettings.exists())
{
Log.warning("JitsiVideobridge-Info: Properties-file does exist= " + pluginsettings.getPath());
try {
props.load(new FileInputStream(pluginsettings));
if (props.getProperty("port") != null)
{
port = props.getProperty("port");
Log.warning("JitsiVideobridge-Info: JitsiVideobridge-port from properties-file is= " + port);
}
if (props.getProperty("protocol") != null)
{
protocol = props.getProperty("protocol");
Log.warning("JitsiVideobridge-Info: JitsiVideobridge-protocol from properties-file is= " + protocol);
}
if (props.getProperty("server") != null)
{
server = props.getProperty("server");
Log.warning("JitsiVideobridge-Info: JitsiVideobridge-server from properties-file is= " + server);
}
url = protocol + "://" + server + ":" + port + "/jitsi/apps/ofmeet/?";
} catch (IOException ioe) {
System.err.println(ioe);
//TODO handle error better.
}
} else {
Log.warning("JitsiVideobridge-Error: Properties-file does not exist= " + pluginsettings.getPath() + ", using default " + url);
}
chatManager.addChatRoomListener(this);
}
public void shutdown()
{
try
{
Log.warning("shutdown");
chatManager.removeChatRoomListener(this);
}
catch(Exception e)
{
Log.warning("shutdown " + e);
}
}
public boolean canShutDown()
{
return true;
}
public void uninstall()
{
}
public void chatRoomLeft(ChatRoom chatroom)
{
}
public void chatRoomClosed(ChatRoom chatroom)
{
String roomId = chatroom.getRoomname();
Log.warning("chatRoomClosed: " + roomId);
if (decorators.containsKey(roomId))
{
ChatRoomDecorator decorator = decorators.remove(roomId);
decorator.finished();
decorator = null;
}
}
public void chatRoomActivated(ChatRoom chatroom)
{
String roomId = chatroom.getRoomname();
Log.warning("chatRoomActivated: " + roomId);
}
public void userHasJoined(ChatRoom room, String s)
{
String roomId = room.getRoomname();
Log.warning("userHasJoined: " + roomId + " " + s);
}
public void userHasLeft(ChatRoom room, String s)
{
String roomId = room.getRoomname();
Log.warning("userHasLeft: " + roomId + " " + s);
}
public void chatRoomOpened(final ChatRoom room)
{
String roomId = room.getRoomname();
Log.warning("chatRoomOpened: " + roomId);
if (roomId.indexOf('/') == -1)
{
decorators.put(roomId, new ChatRoomDecorator(room, url));
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment