org.jitsi.util.OSUtils Java Examples
The following examples show how to use
org.jitsi.util.OSUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SelectScreenDialog.java From jitsi with Apache License 2.0 | 6 votes |
/** * Constructs <tt>DeviceComboBoxField</tt> instance. * @param desktopDevices list with the available devices. * @param devicePanel the container of the field. */ public DeviceComboBoxField(Container devicePanel, List<MediaDevice> desktopDevices) { if(!OSUtils.IS_WINDOWS) { deviceComboBox = new JComboBox(desktopDevices.toArray()); deviceComboBox.setRenderer(new ComboRenderer()); devicePanel.add(deviceComboBox); deviceComponent = deviceComboBox; } else { deviceList = new JList(desktopDevices.toArray()); deviceList.setCellRenderer(new ComboRenderer()); JScrollPane listScroller = new JScrollPane(deviceList); listScroller.setPreferredSize(new Dimension(200, 38)); deviceList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); deviceList.setLayoutOrientation(JList.VERTICAL); deviceList.setVisibleRowCount(-1); deviceList.setSelectedValue(desktopDevices.get(0), true); devicePanel.add(listScroller, BorderLayout.NORTH); deviceComponent = deviceList; } }
Example #2
Source File: GrowlNotificationActivator.java From jitsi with Apache License 2.0 | 6 votes |
/** * Initializes and starts a new <tt>GrowlNotificationService</tt> * implementation on Mac OS X. * * @param bundleContext the <tt>BundleContext</tt> to register the new * <tt>GrowlNotificationService</tt> implementation into * @throws Exception if initializing and/or starting the new * <tt>GrowlNotificationService</tt> implementation fails */ public void start(BundleContext bundleContext) throws Exception { // This bundle is available for Mac OS X only. if (!OSUtils.IS_MAC) return; if (logger.isInfoEnabled()) logger.info("Growl Notification... [Starting]"); GrowlNotificationActivator.bundleContext = bundleContext; handler = new GrowlNotificationServiceImpl(); handler.start(bundleContext); bundleContext.registerService( PopupMessageHandler.class.getName(), handler, null); if (logger.isInfoEnabled()) logger.info("Growl Notification... [Started]"); }
Example #3
Source File: ConfigurationUtils.java From jitsi with Apache License 2.0 | 5 votes |
private static boolean isPinnedToTaskBar() { if (!OSUtils.IS_WINDOWS) { return false; } File taskbar = new File(System.getenv("appdata"), "Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar"); if (!taskbar.exists()) { return false; } File[] pins = taskbar.listFiles(new FileFilter() { @Override public boolean accept(File f) { return f.getName().endsWith(".lnk"); } }); String title = UtilActivator.getResources() .getSettingsString("service.gui.APPLICATION_NAME"); for (File pin : pins) { if (pin.getName().contains(title)) { return true; } } return false; }
Example #4
Source File: GrowlNotificationActivator.java From jitsi with Apache License 2.0 | 5 votes |
/** * Stops this bundle. * * @param bundleContext the <tt>BundleContext</tt> to stop this bundle into * @throws Exception if stopping this bundle fails */ public void stop(BundleContext bundleContext) throws Exception { // This bundle is available for Mac OS X only. if (!OSUtils.IS_MAC) return; handler.stop(bundleContext); if (logger.isInfoEnabled()) logger.info("Growl Notification Service... [Stopped]"); }
Example #5
Source File: MediaConfigurationImpl.java From jitsi with Apache License 2.0 | 5 votes |
/** * Constructs <tt>DeviceComboBoxField</tt> instance. * @param type the type of the configuration panel * @param devicePanel the container of the field. */ public DeviceComboBoxField(final int type, Container devicePanel) { model = new DeviceConfigurationComboBoxModel( mediaService.getDeviceConfiguration(), type); if(!OSUtils.IS_WINDOWS || type != DeviceConfigurationComboBoxModel.VIDEO) { deviceComboBox = new JComboBox(); deviceComboBox.setEditable(false); deviceComboBox.setModel(model); devicePanel.add(deviceComboBox); deviceComponent = deviceComboBox; } else { deviceList = new JList(); deviceList.setModel(model); JScrollPane listScroller = new JScrollPane(deviceList); listScroller.setPreferredSize(new Dimension(200, 38)); deviceList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); deviceList.setLayoutOrientation(JList.VERTICAL); deviceList.setVisibleRowCount(-1); deviceList.setSelectedValue(model.getSelectedItem(), true); devicePanel.add(listScroller); deviceComponent = deviceList; } }
Example #6
Source File: Pa.java From libjitsi with Apache License 2.0 | 5 votes |
/** * Gets the suggested latency to be used when opening PortAudio streams. * * @return the suggested latency to be used when opening PortAudio streams */ public static double getSuggestedLatency() { ConfigurationService cfg = LibJitsi.getConfigurationService(); if (cfg != null) { String suggestedLatencyString = cfg.getString(PROP_SUGGESTED_LATENCY); if (suggestedLatencyString != null) { try { double suggestedLatency = Double.parseDouble(suggestedLatencyString); if (suggestedLatency != LATENCY_UNSPECIFIED) return suggestedLatency; } catch (NumberFormatException nfe) { logger.error( "Failed to parse configuration property " + PROP_SUGGESTED_LATENCY + " value as a double", nfe); } } } if (OSUtils.IS_MAC || OSUtils.IS_LINUX) return LATENCY_HIGH; else if (OSUtils.IS_WINDOWS) return 0.1d; else return LATENCY_UNSPECIFIED; }
Example #7
Source File: ClientCapabilities.java From jitsi with Apache License 2.0 | 4 votes |
/** * The method is called by a ProtocolProvider implementation whenever * a change in the registration state of the corresponding provider had * occurred. The method is particularly interested in events stating * that the SIP provider has unregistered so that it would fire * status change events for all contacts in our buddy list. * * @param evt ProviderStatusChangeEvent the event describing the status * change. */ public void registrationStateChanged(RegistrationStateChangeEvent evt) { if(evt.getNewState() == RegistrationState.UNREGISTERING || evt.getNewState() == RegistrationState.UNREGISTERED || evt.getNewState() == RegistrationState.AUTHENTICATION_FAILED || evt.getNewState() == RegistrationState.CONNECTION_FAILED) { // stop any task associated with the timer if (keepAliveTimer != null) { keepAliveTimer.cancel(); keepAliveTimer = null; } } else if (evt.getNewState().equals(RegistrationState.REGISTERED)) { String keepAliveMethod = provider.getAccountID().getAccountPropertyString( ProtocolProviderFactory.KEEP_ALIVE_METHOD); if (logger.isTraceEnabled()) logger.trace("Keep alive method " + keepAliveMethod); // options is default keep-alive, if property is missing // then options is used if(keepAliveMethod != null && !(keepAliveMethod.equalsIgnoreCase("options") || keepAliveMethod.equalsIgnoreCase("crlf"))) return; int keepAliveInterval = provider.getAccountID().getAccountPropertyInt( ProtocolProviderFactory.KEEP_ALIVE_INTERVAL, -1); if (logger.isTraceEnabled()) logger.trace("Keep alive interval is " + keepAliveInterval); if (keepAliveInterval > 0 && !provider.getRegistrarConnection().isRegistrarless()) { if (keepAliveTimer == null) keepAliveTimer = new Timer(); TimerTask keepAliveTask; // CRLF is used by default on Android if( (OSUtils.IS_ANDROID && keepAliveMethod == null) || "crlf".equalsIgnoreCase(keepAliveMethod) ) { keepAliveTask = new CRLfKeepAliveTask(); } else { // OPTIONS keepAliveTask = new OptionsKeepAliveTask(); } if (logger.isDebugEnabled()) logger.debug("Scheduling keep alives: "+keepAliveTask); keepAliveTimer.schedule(keepAliveTask, 0, keepAliveInterval * 1000); } } }
Example #8
Source File: JAWTRenderer.java From libjitsi with Apache License 2.0 | 4 votes |
/** * Gets the AWT <tt>Component</tt> into which this <tt>VideoRenderer</tt> * draws. * * @return the AWT <tt>Component</tt> into which this <tt>VideoRenderer</tt> * draws */ @Override public synchronized Component getComponent() { if (component == null) { StringBuilder componentClassName = new StringBuilder(); componentClassName.append( "org.jitsi.impl.neomedia.jmfext.media.renderer.video" + ".JAWTRenderer"); if (OSUtils.IS_ANDROID) componentClassName.append("Android"); componentClassName.append("VideoComponent"); Throwable reflectiveOperationException = null; try { Class<?> componentClass = Class.forName(componentClassName.toString()); Constructor<?> componentConstructor = componentClass.getConstructor(JAWTRenderer.class); component = (Component) componentConstructor.newInstance(this); } catch (ClassNotFoundException cnfe) { reflectiveOperationException = cnfe; } catch (IllegalAccessException iae) { reflectiveOperationException = iae; } catch (InstantiationException ie) { reflectiveOperationException = ie; } catch (InvocationTargetException ite) { reflectiveOperationException = ite; } catch (NoSuchMethodException nsme) { reflectiveOperationException = nsme; } if (reflectiveOperationException != null) throw new RuntimeException(reflectiveOperationException); // Make sure to have non-zero height and width because actual video // frames may have not been processed yet. component.setSize( DEFAULT_COMPONENT_HEIGHT_OR_WIDTH, DEFAULT_COMPONENT_HEIGHT_OR_WIDTH); // XXX The component has not been exposed outside of this instance // yet so it seems relatively safe to set its properties outside the // AWT event dispatching thread. reflectInputFormatOnComponentInEventDispatchThread(); } return component; }