All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hn.im.easemob.comm.body.VideoMessageBody Maven / Gradle / Ivy

There is a newer version: 1.0.18
Show newest version
package com.hn.im.easemob.comm.body;

import com.fasterxml.jackson.databind.node.ContainerNode;
import com.hn.im.easemob.comm.constant.MsgType;
import cn.hutool.core.util.StrUtil;

import java.util.Map;

public class VideoMessageBody extends MessageBody {
	private String url;
	private String filename;
	private String secret;
	private Long length;
	private Long fileLength;
	private String thumb;
	private String thumbSecret;
	
	public VideoMessageBody(String targetType, String[] targets, String from, Map ext, String url, String filename, String secret, Long length, Long fileLength,
                            String thumb, String thumbSecret) {
		super(targetType, targets, from, ext);
		this.url = url;
		this.filename = filename;
		this.secret = secret;
		this.length = length;
		this.fileLength = fileLength;
		this.thumb = thumb;
		this.thumbSecret = thumbSecret;

	}

	public String getUrl() {
		return url;
	}

	public String getFilename() {
		return filename;
	}

	public String getSecret() {
		return secret;
	}

	public Long getLength() {
		return length;
	}

	public Long getFileLength() {
		return fileLength;
	}

	public String getThumb() {
		return thumb;
	}

	public String getThumbSecret() {
		return thumbSecret;
	}

	public ContainerNode getBody() {
		if(!this.isInit()){
			this.getMsgBody().put("type", MsgType.VIDEO);
			this.getMsgBody().put("url", url);
			this.getMsgBody().put("filename", filename);
			this.getMsgBody().put("secret", secret);
			this.getMsgBody().put("length", length);
			this.getMsgBody().put("file_length", fileLength);
			this.getMsgBody().put("thumb", thumb);
			this.getMsgBody().put("thumb_secret", thumbSecret);

			this.setInit(true);
		}

		return this.getMsgBody();
	}

	@Override
	public Boolean validate() {
		return super.validate() && StrUtil.isNotBlank(url) && StrUtil.isNotBlank(filename) && StrUtil.isNotBlank(secret) && null != length && null != fileLength && StrUtil.isNotBlank(thumb) && StrUtil.isNotBlank(thumbSecret);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy