27
This commit is contained in:
+30
-4
@@ -3,6 +3,9 @@ import IMSDK,{IMMethods} from "openim-uniapp-polyfill";
|
||||
import {offlinePushInfo} from "@/util/imCommon";
|
||||
import {upload} from "@/api/login.js";
|
||||
import {getVideoInfo} from "@/util/common";
|
||||
// #ifdef APP
|
||||
import {downloadFile} from "@/uni_modules/network-manage";
|
||||
// #endif
|
||||
export const imapi = (method,data)=>{
|
||||
return new Promise((resolve, reject) => {
|
||||
IMSDK.asyncApi(method,IMSDK.uuid(),data)
|
||||
@@ -19,10 +22,30 @@ export const copyFileToTempPath = (src) => {
|
||||
console.log('src', src);
|
||||
console.log('src', src.includes(plus.io.PRIVATE_DOC));
|
||||
return new Promise((resolve, reject) => {
|
||||
plus.io.resolveLocalFileSystemURL(src, (entry) => {
|
||||
const cacheFilePath = '_doc/uniapp_temp/'+entry.name;
|
||||
console.log('cacheFilePath', cacheFilePath);
|
||||
const task = downloadFile({
|
||||
url:src,
|
||||
timeout: 30000,
|
||||
filePath:cacheFilePath,
|
||||
success(res) {
|
||||
console.log('res',res);
|
||||
},
|
||||
fail(e){
|
||||
console.log('e',e);
|
||||
},
|
||||
complate(){
|
||||
task = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
return ;
|
||||
|
||||
plus.io.resolveLocalFileSystemURL(src, (entry) => {
|
||||
console.log('entry name', entry.name);
|
||||
console.log('dir', '_doc/uniapp_temp/');
|
||||
entry.copyTo('_doc/uniapp_temp/', entry.name, (newEntry) => {
|
||||
entry.copyTo(plus.io.PUBLIC_DOCUMENTS, '/uniapp_temp/'+entry.name, (newEntry) => {
|
||||
console.log('newEntry', newEntry.fullPath);
|
||||
resolve(newEntry.toLocalURL());
|
||||
}, reject);
|
||||
@@ -61,9 +84,9 @@ export const getVideoCover = async (path)=>{
|
||||
export const createVideoMessage = (path)=>{
|
||||
return new Promise(async(resolve, reject) => {
|
||||
console.log('处理前的可用路径', path);
|
||||
const realVideoPath = await copyFileToTempPath(path);
|
||||
//const realVideoPath = await getPurePath(path);
|
||||
console.log('处理后的可用路径', realVideoPath);
|
||||
//const realVideoPath = await copyFileToTempPath(path);
|
||||
const realVideoPath = await getPurePath(path);
|
||||
//console.log('处理后的可用路径', realVideoPath);
|
||||
const info = await getVideoInfo(realVideoPath);
|
||||
console.log('info', info);
|
||||
const cover = await getVideoCover(realVideoPath);
|
||||
@@ -80,6 +103,9 @@ export const createVideoMessage = (path)=>{
|
||||
})
|
||||
});
|
||||
console.log('videoresult', videoresult);
|
||||
const video_url = "";
|
||||
//封面
|
||||
const cover_url = `${video_url}?x-oss-process=video/snapshot,t_7000,f_jpg,w_800,h_600,m_fast`;
|
||||
uni.hideLoading();
|
||||
|
||||
if(videoresult.code !=0){
|
||||
|
||||
Reference in New Issue
Block a user