648540858
2021-12-10 faac93613a997e226998018e1165412b33989f32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.genersoft.iot.vmp.media.zlm.event;
 
import com.genersoft.iot.vmp.conf.UserSetup;
import com.genersoft.iot.vmp.service.IMediaServerService;
import com.genersoft.iot.vmp.service.IStreamProxyService;
import com.genersoft.iot.vmp.service.IStreamPushService;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
 
/**
 *
 */
@Component
public class ZLMOfflineEventListener implements ApplicationListener<ZLMOfflineEvent> {
 
    private final static Logger logger = LoggerFactory.getLogger(ZLMOfflineEventListener.class);
 
    @Autowired
    private IMediaServerService mediaServerService;
 
    @Autowired
    private IStreamPushService streamPushService;
 
    @Autowired
    private IStreamProxyService streamProxyService;
 
    @Override
    public void onApplicationEvent(ZLMOfflineEvent event) {
 
        logger.info("ZLM离线事件触发,ID:" + event.getMediaServerId());
        // 处理ZLM离线
        mediaServerService.zlmServerOffline(event.getMediaServerId());
        streamProxyService.zlmServerOffline(event.getMediaServerId());
        streamPushService.zlmServerOffline(event.getMediaServerId());
        // TODO 处理对国标的影响
    }
}