11111
This commit is contained in:
parent
8a9083f9b5
commit
8280e43a46
20
common/src/main/java/com/yunbao/common/utils/TimeUtils.java
Normal file
20
common/src/main/java/com/yunbao/common/utils/TimeUtils.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
/**
|
||||
* 时间处理
|
||||
*/
|
||||
public class TimeUtils {
|
||||
/**
|
||||
* 毫秒转秒
|
||||
* @param duration 毫秒数
|
||||
* @return
|
||||
*/
|
||||
public static long durationToSecond(long duration) {
|
||||
long toSecond = 0;
|
||||
long seconds = duration % 60000;
|
||||
long second = Math.round((float) seconds / 1000);
|
||||
long minute = duration / 60000;
|
||||
toSecond = ((minute * 60) + second);
|
||||
return toSecond;
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ import android.widget.LinearLayout;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.yunbao.common.utils.FileUtil;
|
||||
import com.yunbao.common.utils.TimeUtils;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.utils.FileSizeUtil;
|
||||
@ -262,11 +263,9 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
|
||||
* @param duration 视频时长
|
||||
*/
|
||||
private void sendSightExtension(String filePath, long duration) {
|
||||
long seconds = duration % 60000 ;
|
||||
long second = Math.round((float)seconds/1000) ;
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
Uri localUri = Uri.parse("file://" + filePath);
|
||||
SightMessage sightMessage = SightMessage.obtain(localUri, (int) second);
|
||||
SightMessage sightMessage = SightMessage.obtain(localUri, (int) TimeUtils.durationToSecond(duration));
|
||||
Message message = Message.obtain(targetId, conversationType, sightMessage);
|
||||
IMCenter.getInstance().sendMediaMessage(message, null, null, new IRongCallback.ISendMediaMessageCallback() {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user