封装IOS原生视频多选插件,实现基本多选功能。至此,module类型插件双端都已开发完毕,但交互没有component类型插件自由,且后续上传、断点续传需要继续封装进插件,否则该功能仅能多选,无法上传发送

This commit is contained in:
wangyifeng 2025-04-30 11:34:25 +08:00
parent 22c254fffd
commit 680dc77917
5 changed files with 62 additions and 23 deletions

View File

@ -157,7 +157,7 @@
"__plugin_info__" : { "__plugin_info__" : {
"name" : "视频多选原生SDK", "name" : "视频多选原生SDK",
"description" : "封装到js端使用", "description" : "封装到js端使用",
"platforms" : "Android", "platforms" : "Android,iOS",
"url" : "", "url" : "",
"android_package_name" : "", "android_package_name" : "",
"ios_bundle_id" : "", "ios_bundle_id" : "",

View File

@ -30,6 +30,16 @@
"armeabi-v7a","arm64-v8a","x86" "armeabi-v7a","arm64-v8a","x86"
], ],
"minSdkVersion": "21" "minSdkVersion": "21"
},
"ios": {
"plugins": [{
"type": "module",
"name": "VideoPickerUniPlugin-VideoPickerModule",
"class": "VideoPickerModule"
}],
"frameworks": ["VideoPickerUniPlugin.framework"],
"integrateType": "framework",
"deploymentTarget": "11.0"
} }
} }
} }

View File

@ -138,28 +138,57 @@ commun.registerHandler('operateSQLite', async (data) => {
}) })
commun.registerHandler('VideoPicker', async () => { commun.registerHandler('VideoPicker', async () => {
console.error("=======BASE==VideoPicker") console.error('=======BASE==VideoPicker')
uni.requireNativePlugin('VideoPicker').pickVideos( console.error(uni.getSystemInfoSync().osName)
{ maxCount: 9 }, if (uni.getSystemInfoSync().osName === 'ios') {
(res) => { //IOS
console.log('选中的视频:', res.paths) uni
let allWebview = plus.webview.all() .requireNativePlugin('VideoPickerUniPlugin-VideoPickerModule')
allWebview.forEach((webview) => { .pickVideos(
if (webview.id === 'chat') { { maxCount: 9 },
//webview (res) => {
console.log('找到聊天的webview', webview) console.log('选中的视频列表:', res.videoList)
webview.evalJS( let allWebview = plus.webview.all()
`getBaseMulVideo('${encodeURIComponent( allWebview.forEach((webview) => {
JSON.stringify(res.paths), if (webview.id === 'chat') {
)}')`, //webview
) console.log('找到聊天的webview', webview)
} webview.evalJS(
}) `getBaseMulVideo('${encodeURIComponent(
}, JSON.stringify(res.videoList),
(err) => { )}')`,
console.error('选择失败:', err) )
}, }
) })
},
(ret) => {
console.error('调用异步方法 ' + ret)
},
)
} else {
//
uni.requireNativePlugin('VideoPicker').pickVideos(
{ maxCount: 9 },
(res) => {
console.log('选中的视频:', res.paths)
let allWebview = plus.webview.all()
allWebview.forEach((webview) => {
if (webview.id === 'chat') {
//webview
console.log('找到聊天的webview', webview)
webview.evalJS(
`getBaseMulVideo('${encodeURIComponent(
JSON.stringify(res.paths),
)}')`,
)
}
})
},
(err) => {
console.error('选择失败:', err)
},
)
}
}) })
// //