This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch 4.0.x
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/4.0.x by this push:
     new b34adee  [OPENMEETINGS-1877] RPC calls are added back
b34adee is described below

commit b34adee8d385c1e116c170f2043390b889818a7d
Author: Maxim Solodovnik <[email protected]>
AuthorDate: Wed Apr 25 21:05:36 2018 +0700

    [OPENMEETINGS-1877] RPC calls are added back
---
 .../core/remote/ScopeApplicationAdapter.java       | 27 ++++++--
 .../apache/openmeetings/db/dto/room/CheckDto.java  | 74 ++++++++++++++++++++++
 openmeetings-flash/src/main/flex/main.mxml         | 71 +++++++++++++--------
 .../main/flex/org/apache/openmeetings/OmVideo.as   |  7 +-
 4 files changed, 141 insertions(+), 38 deletions(-)

diff --git 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
index 78e417c..cd76dd4 100644
--- 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
+++ 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
@@ -37,7 +37,6 @@ import java.util.Map;
 import java.util.UUID;
 
 import org.apache.openmeetings.IApplication;
-import org.apache.openmeetings.core.converter.BaseConverter;
 import org.apache.openmeetings.core.service.RecordingService;
 import org.apache.openmeetings.core.util.IClientUtil;
 import org.apache.openmeetings.core.util.WebSocketHelper;
@@ -48,6 +47,7 @@ import org.apache.openmeetings.db.dao.record.RecordingDao;
 import org.apache.openmeetings.db.dao.room.RoomDao;
 import org.apache.openmeetings.db.dao.room.SipDao;
 import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.dto.room.CheckDto;
 import org.apache.openmeetings.db.entity.basic.Client;
 import org.apache.openmeetings.db.entity.log.ConferenceLog;
 import org.apache.openmeetings.db.entity.room.Room;
@@ -501,12 +501,6 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                        String streamName = stream.getPublishedName();
                        _log.debug("start streamPublishStart broadcast start: 
{}, CONN {}", streamName, current);
                        c.setBroadcastId(streamName);
-                       final int sizeIdx = streamName.indexOf("__");
-                       if (sizeIdx > -1) {
-                               BaseConverter.Dimension d = 
BaseConverter.getDimension(streamName.substring(sizeIdx + 2));
-                               c.setWidth(d.getWidth());
-                               c.setHeight(d.getHeight());
-                       }
 
                        if (Client.Type.sharing != c.getType() && 
Client.Type.mobile != c.getType()) {
                                if (Strings.isEmpty(c.getAvsettings()) || 
"n".equals(c.getAvsettings())) {
@@ -1036,4 +1030,23 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                }
                return count != null && count > 0 ? count - 1 : 0;
        }
+
+       public CheckDto check() {
+               IConnection current = Red5.getConnectionLocal();
+               StreamClient c = 
streamClientManager.get(IClientUtil.getId(current.getClient()));
+               Client cl = clientManager.getBySid(c.getSid());
+               return new CheckDto(cl);
+       }
+
+       public void resize(Double width, Double height) {
+               if (width == null || height == null) {
+                       return;
+               }
+               IConnection current = Red5.getConnectionLocal();
+               StreamClient c = 
streamClientManager.get(IClientUtil.getId(current.getClient()));
+               if (c == null) {
+                       return;
+               }
+               
streamClientManager.update(c.setWidth(width.intValue()).setHeight(height.intValue()));
+       }
 }
diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/CheckDto.java
 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/CheckDto.java
new file mode 100644
index 0000000..1ef1d2b
--- /dev/null
+++ 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/CheckDto.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.openmeetings.db.dto.room;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.openmeetings.db.entity.basic.Client;
+import org.apache.openmeetings.db.entity.basic.Client.Activity;
+import org.apache.openmeetings.db.entity.basic.Client.Pod;
+import org.apache.openmeetings.db.entity.room.Room;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
+public class CheckDto {
+       private final long roomId;
+       private final Room.Type roomType;
+       private final boolean audioOnly;
+       private final Set<Activity> activities = new HashSet<>();
+       private final Pod pod;
+
+       public CheckDto(Client c) {
+               roomId = c.getRoom().getId();
+               roomType = c.getRoom().getType();
+               audioOnly = c.getRoom().isAudioOnly();
+               if (c.hasActivity(Activity.broadcastA)) {
+                       activities.add(Activity.broadcastA);
+               }
+               if (c.hasActivity(Activity.broadcastV)) {
+                       activities.add(Activity.broadcastV);
+               }
+               pod = c.getPod();
+       }
+
+       public long getRoomId() {
+               return roomId;
+       }
+
+       public Room.Type getRoomType() {
+               return roomType;
+       }
+
+       public boolean isAudioOnly() {
+               return audioOnly;
+       }
+
+       public Set<Activity> getActivities() {
+               return activities;
+       }
+
+       public Pod getPod() {
+               return pod;
+       }
+}
diff --git a/openmeetings-flash/src/main/flex/main.mxml 
b/openmeetings-flash/src/main/flex/main.mxml
index 2d2a378..d1bfa09 100644
--- a/openmeetings-flash/src/main/flex/main.mxml
+++ b/openmeetings-flash/src/main/flex/main.mxml
@@ -184,35 +184,50 @@
                                        
ExternalInterface.addCallback("setRights", setRightsCallback);
                                        
ExternalInterface.addCallback("cleanup", cleanupCallback);
                                        video.connect(function ():void {
-                                               checkAvPermissions(function 
():void {
-                                                       addImage(params.width, 
params.height);
-                                                       _resize(params.width, 
params.height);
-                                                       _updateExclusive();
-                                                       
activityTimer.addEventListener(TimerEvent.TIMER, broadcastTimerListener);
-                                                       refreshBroadcast(null);
-                                                       
ExternalInterface.call("VideoManager.securityMode", params.uid, false);
-                                                       
ExternalInterface.addCallback("refresh", refreshBroadcast);
-                                                       
ExternalInterface.addCallback("update", function(c:Object):void {
-                                                               var 
pVideo:Boolean = hasVideo(), nVideo:Boolean = _hasVideo(c.activities)
-                                                                               
, pAudio:Boolean = hasAudio(), nAudio:Boolean = _hasAudio(c.activities);
-                                                               if (nVideo != 
pVideo || nAudio != pAudio) {
-                                                                       // 
activities are changed
-                                                                       
activities = c.activities;
-                                                                       if 
(nVideo && pVideo) {
-                                                                               
nAudio ? video.unmute() : video.mute();
-                                                                               
if (mic != null) {
-                                                                               
        activityTimer.start();
-                                                                               
} else {
-                                                                               
        activityTimer.stop();
-                                                                               
}
-                                                                       } else {
-                                                                               
refreshBroadcast(null);
-                                                                       }
-                                                               }
-                                                               
_updateExclusive();
-                                                               //debug("Client 
updated: ", c);
+                                               // trust no-one
+                                               video.getNc().call("check", new 
Responder(function (check:Object):void {
+                                                       debug("check", check);
+                                                       audioOnly = 
check.audioOnly;
+                                                       activities = 
check.activities;
+                                                       interview = 'interview' 
== check.roomType;
+                                                       
checkAvPermissions(function ():void {
+                                                               // trust no-one
+                                                               
video.getNc().call("check", new Responder(function (check:Object):void {
+                                                                       
debug("check", check);
+                                                                       
activities = check.activities;
+                                                                       
addImage(params.width, params.height);
+                                                                       
_resize(params.width, params.height);
+                                                                       
_updateExclusive();
+                                                                       
activityTimer.addEventListener(TimerEvent.TIMER, broadcastTimerListener);
+                                                                       
refreshBroadcast(null);
+                                                                       
ExternalInterface.call("VideoManager.securityMode", params.uid, false);
+                                                                       
ExternalInterface.addCallback("refresh", refreshBroadcast);
+                                                                       
ExternalInterface.addCallback("update", function ():void {
+                                                                               
video.getNc().call("check", new Responder(function (check:Object):void {
+                                                                               
        debug("check", check);
+                                                                               
        var pVideo:Boolean = hasVideo(), nVideo:Boolean = 
_hasVideo(check.activities)
+                                                                               
                        , pAudio:Boolean = hasAudio(), nAudio:Boolean = 
_hasAudio(check.activities);
+                                                                               
        if (nVideo != pVideo || nAudio != pAudio) {
+                                                                               
                // activities are changed
+                                                                               
                activities = check.activities;
+                                                                               
                if (nVideo && pVideo) {
+                                                                               
                        nAudio ? video.unmute() : video.mute();
+                                                                               
                        if (mic != null) {
+                                                                               
                                activityTimer.start();
+                                                                               
                        } else {
+                                                                               
                                activityTimer.stop();
+                                                                               
                        }
+                                                                               
                } else {
+                                                                               
                        refreshBroadcast(null);
+                                                                               
                }
+                                                                               
        }
+                                                                               
        _updateExclusive();
+                                                                               
        //debug("Client updated: ", c);
+                                                                               
}));
+                                                                       });
+                                                               }));
                                                        });
-                                               });
+                                               }))
                                        });
                                }
                                        break;
diff --git 
a/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as 
b/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
index bc863db..cd0a0e8 100644
--- a/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
+++ b/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
@@ -193,8 +193,7 @@ public class OmVideo {
                this.mic = _mic;
                createStream();
 
-               ns.publish(name + "__" + (cam === null ? 0 : cam.width) + "x" + 
(cam === null ? 0 : cam.height)
-                               , (mode === BROADCAST) ? LIVE : mode);
+               ns.publish(name, (mode === BROADCAST) ? LIVE : mode);
                ns.attachCamera(cam);
                attachCamera(cam);
                if (cam !== null) {
@@ -307,7 +306,9 @@ public class OmVideo {
 
        public function broadcast(name:String, cam:Camera, 
_mic:Microphone):void {
                connect(function():void {
-                       _publish(BROADCAST, name, cam, _mic, null);
+                       nc.call("resize", new Responder(function ():void {
+                               _publish(BROADCAST, name, cam, _mic, null);
+                       }), cam === null ? 0 : cam.width, cam === null ? 0 : 
cam.height);
                });
        }
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to