64 lines
1.9 KiB
Java
64 lines
1.9 KiB
Java
package com.tencent.mm.opensdk.modelmsg;
|
|
|
|
import android.os.Bundle;
|
|
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
|
|
import com.tencent.mm.opensdk.utils.Log;
|
|
import java.io.File;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class WXVideoFileObject implements WXMediaMessage.IMediaObject {
|
|
private static final int FILE_SIZE_LIMIT = 10485760;
|
|
private static final String TAG = "MicroMsg.SDK.WXVideoFileObject";
|
|
public String filePath;
|
|
|
|
public WXVideoFileObject() {
|
|
this.filePath = null;
|
|
}
|
|
|
|
public WXVideoFileObject(String str) {
|
|
this.filePath = str;
|
|
}
|
|
|
|
private int getFileSize(String str) {
|
|
if (str == null || str.length() == 0) {
|
|
return 0;
|
|
}
|
|
File file = new File(str);
|
|
if (file.exists()) {
|
|
return (int) file.length();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
@Override // com.tencent.mm.opensdk.modelmsg.WXMediaMessage.IMediaObject
|
|
public boolean checkArgs() {
|
|
String str;
|
|
String str2 = this.filePath;
|
|
if (str2 == null || str2.length() == 0) {
|
|
str = "checkArgs fail, filePath is null";
|
|
} else {
|
|
if (getFileSize(this.filePath) <= FILE_SIZE_LIMIT) {
|
|
return true;
|
|
}
|
|
str = "checkArgs fail, video file size is too large";
|
|
}
|
|
Log.e(TAG, str);
|
|
return false;
|
|
}
|
|
|
|
@Override // com.tencent.mm.opensdk.modelmsg.WXMediaMessage.IMediaObject
|
|
public void serialize(Bundle bundle) {
|
|
bundle.putString("_wxvideofileobject_filePath", this.filePath);
|
|
}
|
|
|
|
@Override // com.tencent.mm.opensdk.modelmsg.WXMediaMessage.IMediaObject
|
|
public int type() {
|
|
return 38;
|
|
}
|
|
|
|
@Override // com.tencent.mm.opensdk.modelmsg.WXMediaMessage.IMediaObject
|
|
public void unserialize(Bundle bundle) {
|
|
this.filePath = bundle.getString("_wxvideofileobject_filePath");
|
|
}
|
|
}
|