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 LCIMAudioMessage : LCIMFileMessage {
|
|
|
|
|
public double Duration {
|
|
|
|
|
get {
|
2020-03-18 16:21:29 +08:00
|
|
|
|
if (double.TryParse(File.MetaData["duration"] as string, out double duration)) {
|
2020-03-18 11:41:13 +08:00
|
|
|
|
return duration;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-18 16:21:29 +08:00
|
|
|
|
internal LCIMAudioMessage() {
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-18 11:41:13 +08:00
|
|
|
|
public LCIMAudioMessage(LCFile file) : base(file) {
|
2020-03-18 16:21:29 +08:00
|
|
|
|
|
2020-03-12 16:23:21 +08:00
|
|
|
|
}
|
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("duration", out object duration)) {
|
|
|
|
|
metaData["duration"] = duration;
|
|
|
|
|
}
|
2020-03-18 16:21:29 +08:00
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal override int MessageType => AudioMessageType;
|
2020-03-12 16:23:21 +08:00
|
|
|
|
}
|
|
|
|
|
}
|