2020-03-18 16:21:29 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using LeanCloud.Storage;
|
2020-03-18 11:41:13 +08:00
|
|
|
|
|
|
|
|
|
namespace LeanCloud.Realtime {
|
|
|
|
|
public class LCIMVideoMessage : LCIMFileMessage {
|
|
|
|
|
public double Duration {
|
|
|
|
|
get {
|
|
|
|
|
if (double.TryParse(File.MetaData["duration"] as string, out double duration)) {
|
|
|
|
|
return duration;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-18 16:21:29 +08:00
|
|
|
|
internal LCIMVideoMessage() {
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-18 11:41:13 +08:00
|
|
|
|
public LCIMVideoMessage(LCFile file) : base(file) {
|
|
|
|
|
|
|
|
|
|
}
|
2020-03-18 16:21:29 +08:00
|
|
|
|
|
|
|
|
|
internal override Dictionary<string, object> Encode() {
|
|
|
|
|
Dictionary<string, object> data = base.Encode();
|
|
|
|
|
Dictionary<string, object> fileData = data["_lcfile"] as Dictionary<string, object>;
|
|
|
|
|
Dictionary<string, object> metaData = fileData["metaData"] as Dictionary<string, object>;
|
2020-03-24 17:42:04 +08:00
|
|
|
|
if (File.MetaData.TryGetValue("width", out object width)) {
|
|
|
|
|
metaData["width"] = width;
|
|
|
|
|
}
|
|
|
|
|
if (File.MetaData.TryGetValue("height", out object height)) {
|
|
|
|
|
metaData["height"] = height;
|
|
|
|
|
}
|
|
|
|
|
if (File.MetaData.TryGetValue("duration", out object duration)) {
|
|
|
|
|
metaData["duration"] = duration;
|
|
|
|
|
}
|
2020-03-18 16:21:29 +08:00
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal override int MessageType => VideoMessageType;
|
2020-03-18 11:41:13 +08:00
|
|
|
|
}
|
|
|
|
|
}
|