package com.usky.cdi.service.vo.video;

import lombok.Data;

import java.io.Serializable;

/**
 * WVP 点播返回的流信息
 */
@Data
public class VideoPlayInfoVO implements Serializable {

    private static final long serialVersionUID = 1L;

    private String deviceId;

    private String channelId;

    private String app;

    private String stream;

    private String flvUrl;

    private String hlsUrl;

    private String rtspUrl;

    private String rtcUrl;

    private String wsFlvUrl;

    /**
     * 流状态：PUSHING / STOPPED / FAILED
     */
    private String streamStatus;

    public String getPreferredPlayUrl(String protocol) {
        if ("hls".equalsIgnoreCase(protocol) && hlsUrl != null) {
            return hlsUrl;
        }
        if ("rtsp".equalsIgnoreCase(protocol) && rtspUrl != null) {
            return rtspUrl;
        }
        if (flvUrl != null) {
            return flvUrl;
        }
        if (hlsUrl != null) {
            return hlsUrl;
        }
        if (rtspUrl != null) {
            return rtspUrl;
        }
        return rtcUrl;
    }
}
