im::floo::floolib::BMXVideoAttachment
Video attachment of message
Inherits from im.floo.floolib.BMXFileAttachment, im.floo.floolib.BMXMessageAttachment, BMXBaseObject
Public Functions
Name | |
---|---|
synchronized void | delete() |
BMXVideoAttachment(String path, int duration, BMXMessageAttachment.Size size, String displayName) Constructor to build the video attachment to send |
|
BMXVideoAttachment(String path, int duration, BMXMessageAttachment.Size size) | |
BMXVideoAttachment(String path, String thumbnailPath, int duration, BMXMessageAttachment.Size size, String displayName) Constructor to build the video attachment to send |
|
BMXVideoAttachment(String path, String thumbnailPath, int duration, BMXMessageAttachment.Size size) | |
BMXVideoAttachment(String ratelUrl, int duration, BMXMessageAttachment.Size size, String displayName, long fileLength) Constructor to build the video attachment to receive |
|
BMXVideoAttachment(String ratelUrl, String thumbnailUrl, int duration, BMXMessageAttachment.Size size, String displayName, long fileLength) Constructor to build the video attachment to receive |
|
BMXMessageAttachment.Type | type() Type of returned file |
BMXMessageAttachment | clone() Cloning function |
BMXMessageAttachment.Size | size() Video size, width, and height |
int | duration() Length of video clip |
void | setThumbnail(String path) Set the thumbnail for video clip to send |
String | thumbnailPath() Local path of thumbnail |
String | thumbnailUrl() Server path of thumbnail |
void | setThumbnailRatelUrl(String thumbnailRatelUrl) |
String | thumbnailRatelUrl() |
BMXMessageAttachment.DownloadStatus | thumbnailDownloadStatus() Thumbnail downloading state |
BMXVideoAttachment | dynamic_cast(BMXMessageAttachment attachment) |
Protected Functions
Name | |
---|---|
BMXVideoAttachment(long cPtr, boolean cMemoryOwn) | |
void | finalize() |
long | getCPtr(BMXVideoAttachment obj) |
Additional inherited members
Public Functions inherited from im.floo.floolib.BMXFileAttachment
Name | |
---|---|
BMXFileAttachment(String path, String displayName) Constructor to build the message attachment of sent file |
|
BMXFileAttachment(String path) | |
BMXFileAttachment(String ratelUrl, String displayName, long fileLength) Constructor to build the message attachment of received file |
|
String | path() Local path |
String | displayName() Display name |
String | ratelUrl() |
String | url() Remote URL |
long | fileLength() File length |
BMXMessageAttachment.DownloadStatus | downloadStatus() Attachment download state |
Protected Functions inherited from im.floo.floolib.BMXFileAttachment
Name | |
---|---|
BMXFileAttachment(long cPtr, boolean cMemoryOwn) |
Protected Functions inherited from im.floo.floolib.BMXMessageAttachment
Name | |
---|---|
BMXMessageAttachment(long cPtr, boolean cMemoryOwn) |
Public Functions Documentation
function delete
inline synchronized void delete()
Reimplements: im::floo::floolib::BMXFileAttachment::delete
Example:
function BMXVideoAttachment
inline BMXVideoAttachment(
String path,
int duration,
BMXMessageAttachment.Size size,
String displayName
)
Constructor to build the video attachment to send
Parameters:
- path Local path of file
- duration Length of video clip
- size Video size, width, and height
- displayName Display name of file
Example:
function BMXVideoAttachment
inline BMXVideoAttachment(
String path,
int duration,
BMXMessageAttachment.Size size
)
Example:
function BMXVideoAttachment
inline BMXVideoAttachment(
String path,
String thumbnailPath,
int duration,
BMXMessageAttachment.Size size,
String displayName
)
Constructor to build the video attachment to send
Parameters:
- path Local path of file
- thumbnailPath Local path of thumbnail file
- duration Length of video clip
- size Video size, width, and height
- displayName Display name of file
Example:
function BMXVideoAttachment
inline BMXVideoAttachment(
String path,
String thumbnailPath,
int duration,
BMXMessageAttachment.Size size
)
Example:
function BMXVideoAttachment
inline BMXVideoAttachment(
String ratelUrl,
int duration,
BMXMessageAttachment.Size size,
String displayName,
long fileLength
)
Constructor to build the video attachment to receive
Parameters:
- ratelUrl ratel server address
- duration Length of video clip
- size Video size, width, and height
- displayName Display name of file
- fileLength File size
Example:
function BMXVideoAttachment
inline BMXVideoAttachment(
String ratelUrl,
String thumbnailUrl,
int duration,
BMXMessageAttachment.Size size,
String displayName,
long fileLength
)
Constructor to build the video attachment to receive
Parameters:
- ratelUrl ratel server address
- thumbnailUrl Server address of thumbnail file
- duration Length of video clip
- size Video size, width, and height
- displayName Display name of file
- fileLength File size
Example:
function type
inline BMXMessageAttachment.Type type()
Type of returned file
Return: Type
Reimplements: im::floo::floolib::BMXFileAttachment::type
Example:
function clone
inline BMXMessageAttachment clone()
Cloning function
Return: BMXMessageAttachmentPtr
Reimplements: im::floo::floolib::BMXFileAttachment::clone
Example:
function size
inline BMXMessageAttachment.Size size()
Video size, width, and height
Return: Size
Example:
BMImageLoader.getInstance().display(mImageView, "");
return;
}
final BMXVideoAttachment body = BMXVideoAttachment.dynamic_cast(mMaxMessage.attachment());
if (body == null) {
BMImageLoader.getInstance().display(mImageView, "");
return;
}
RelativeLayout.LayoutParams imgLayoutParams = null;
String imgWidth = null, imgHeight = null;
BMXVideoAttachment.Size size = body.size();
if (size != null) {
imgWidth = String.valueOf(size.getMWidth());
imgHeight = String.valueOf(size.getMHeight());
}
double maxLength = ScreenUtils.widthPixels * 0.5;
double minLength = ScreenUtils.widthPixels * 0.5 * 0.5;
if (!TextUtils.isEmpty(imgWidth) && !TextUtils.isEmpty(imgHeight)) {
double limitDiff = maxLength / minLength;
double diff = 0;
function duration
inline int duration()
Length of video clip
Return: int32_t
Example:
function setThumbnail
inline void setThumbnail(
String path
)
Set the thumbnail for video clip to send
Parameters:
- path Thumbnail of video clip message
Example:
function thumbnailPath
inline String thumbnailPath()
Local path of thumbnail
Return: std::string
Example:
function thumbnailUrl
inline String thumbnailUrl()
Server path of thumbnail
Return: std::string
Example:
}
} else {
// 宽高比超过标准宽高比 按标准展示
imgLayoutParams = new RelativeLayout.LayoutParams((int)maxLength, (int)(maxLength * 3 / 4));
}
mImageView.setLayoutParams(imgLayoutParams);
String picUrl = null;
if (!TextUtils.isEmpty(body.path()) && new File(body.path()).exists()) {
picUrl = "file://" + body.path();
BMImageLoader.getInstance().display(mImageView, picUrl, mImageConfig);
} else if (!TextUtils.isEmpty(body.thumbnailUrl())) {
picUrl = body.thumbnailUrl();
BMImageLoader.getInstance().display(mImageView, picUrl, mImageConfig);
ChatManager.getInstance().downloadAttachment(mMaxMessage);
} else {
BMImageLoader.getInstance().display(mImageView, "", mImageConfig);
ChatManager.getInstance().downloadAttachment(mMaxMessage);
}
showVideoProgress();
} else {
// 宽高比超过标准宽高比 按标准展示
imgLayoutParams = new RelativeLayout.LayoutParams((int)maxLength, (int)(maxLength * 3 / 4));
}
mImageView.setLayoutParams(imgLayoutParams);
String picUrl = null;
if (!TextUtils.isEmpty(body.path()) && new File(body.path()).exists()) {
picUrl = "file://" + body.path();
BMImageLoader.getInstance().display(mImageView, picUrl, mImageConfig);
} else if (!TextUtils.isEmpty(body.thumbnailUrl())) {
picUrl = body.thumbnailUrl();
BMImageLoader.getInstance().display(mImageView, picUrl, mImageConfig);
ChatManager.getInstance().downloadAttachment(mMaxMessage);
} else {
BMImageLoader.getInstance().display(mImageView, "", mImageConfig);
ChatManager.getInstance().downloadAttachment(mMaxMessage);
}
showVideoProgress();
function setThumbnailRatelUrl
inline void setThumbnailRatelUrl(
String thumbnailRatelUrl
)
Example:
function thumbnailRatelUrl
inline String thumbnailRatelUrl()
Example:
function thumbnailDownloadStatus
inline BMXMessageAttachment.DownloadStatus thumbnailDownloadStatus()
Thumbnail downloading state
Return: DownloadStatus
Example:
function dynamic_cast
static inline BMXVideoAttachment dynamic_cast(
BMXMessageAttachment attachment
)
Reimplements: im::floo::floolib::BMXFileAttachment::dynamic_cast
Protected Functions Documentation
Example:
private void showVideo() {
registerListener();
if (mMaxMessage == null || mMaxMessage.contentType() != BMXMessage.ContentType.Video) {
BMImageLoader.getInstance().display(mImageView, "");
return;
}
final BMXVideoAttachment body = BMXVideoAttachment.dynamic_cast(mMaxMessage.attachment());
if (body == null) {
BMImageLoader.getInstance().display(mImageView, "");
return;
}
RelativeLayout.LayoutParams imgLayoutParams = null;
String imgWidth = null, imgHeight = null;
BMXVideoAttachment.Size size = body.size();
if (size != null) {
imgWidth = String.valueOf(size.getMWidth());
imgHeight = String.valueOf(size.getMHeight());
}
double maxLength = ScreenUtils.widthPixels * 0.5;
double minLength = ScreenUtils.widthPixels * 0.5 * 0.5;
private void registerListener() {
if (mMaxMessage == null) {
return;
}
boolean register = false;
BMXVideoAttachment body = BMXVideoAttachment.dynamic_cast(mMaxMessage.attachment());
boolean notExit = body != null
&& (TextUtils.isEmpty(body.path()) || !new File(body.path()).exists());
long msgId = mMaxMessage.msgId();
if (mItemPos == ITEM_RIGHT) {
BMXMessage.DeliveryStatus sendStatus = mMaxMessage.deliveryStatus();
register = sendStatus != null && sendStatus != BMXMessage.DeliveryStatus.Deliveried
&& sendStatus != BMXMessage.DeliveryStatus.Failed || notExit;
} else if (mItemPos == ITEM_LEFT) {
register = notExit;
}
if (register) {
if (mProgressCache.get(msgId, -1) == -1) {
mProgressCache.put(msgId, 0);
private void openVideoItemClick(BMXMessage bean) {
if (mView == null || bean == null || bean.contentType() != BMXMessage.ContentType.Video) {
return;
}
BMXVideoAttachment body = BMXVideoAttachment.dynamic_cast(bean.attachment());
if (body == null) {
return;
}
String videoUrl = null;
if (!TextUtils.isEmpty(body.path()) && new File(body.path()).exists()) {
videoUrl = body.path();
}
if (TextUtils.isEmpty(videoUrl)) {
// 正在下载
ToastUtil.showTextViewPrompt(mView.getContext().getString(R.string.downloading));
return;
}
BMXMessageAttachment.DownloadStatus status = body.downloadStatus();
if (status == BMXMessageAttachment.DownloadStatus.Downloaing) {
ToastUtil.showTextViewPrompt(mView.getContext().getString(R.string.downloading));
function BMXVideoAttachment
inline BMXVideoAttachment(
long cPtr,
boolean cMemoryOwn
)
Example:
function finalize
inline void finalize()
Reimplements: im::floo::floolib::BMXFileAttachment::finalize
Example:
function getCPtr
static inline long getCPtr(
BMXVideoAttachment obj
)
Example:
Updated on 2022-01-26 at 17:18:31 +0800