| | |
| | | _liveStreamService.StartLiveStreaming(sn); |
| | | } |
| | | } else { |
| | | // 停止直播 |
| | | if(MessageType.LIVESTREAM.getType().equals(type)){ |
| | | System.out.println("停止直播"); |
| | | _liveStreamService.StopLiveStreaming(sn); |
| | | } |
| | | // 停止直播--前端不主动关注直播,则在断开连接时停止 |
| | | // if(MessageType.LIVESTREAM.getType().equals(type)){ |
| | | // System.out.println("停止直播"); |
| | | // |
| | | // _liveStreamService.StopLiveStreaming(sn); |
| | | // } |
| | | // 取消订阅操作 |
| | | if (subscriptions.containsKey(subscriptionKey)) { |
| | | subscriptions.get(subscriptionKey).remove(userId); |
| | |
| | | */ |
| | | private void removeUserAllSubscriptions(String userId) { |
| | | for (Map.Entry<String, Set<String>> entry : subscriptions.entrySet()) { |
| | | if (entry.getKey().contains(MessageType.LIVESTREAM.getType())) { |
| | | String sn = entry.getKey().split(":")[0]; |
| | | _liveStreamService.StopLiveStreaming(sn); |
| | | } |
| | | // 停止直播逻辑 |
| | | entry.getValue().remove(userId); |
| | | if (entry.getValue().isEmpty()) { |
| | | if (entry.getKey().contains(MessageType.LIVESTREAM.getType())) { |
| | | String sn = entry.getKey().split(":")[0]; |
| | | _liveStreamService.StopLiveStreaming(sn); |
| | | } |
| | | subscriptions.remove(entry.getKey()); |
| | | } |
| | | } |