diff --git a/manifest.json b/manifest.json index 64bcb37..2df3ba6 100644 --- a/manifest.json +++ b/manifest.json @@ -157,7 +157,7 @@ "__plugin_info__" : { "name" : "视频多选原生SDK", "description" : "封装到js端使用", - "platforms" : "Android", + "platforms" : "Android,iOS", "url" : "", "android_package_name" : "", "ios_bundle_id" : "", diff --git a/nativeplugins/VideoPicker/ios/VideoPickerUniPlugin.framework/Info.plist b/nativeplugins/VideoPicker/ios/VideoPickerUniPlugin.framework/Info.plist new file mode 100644 index 0000000..92ec5f3 Binary files /dev/null and b/nativeplugins/VideoPicker/ios/VideoPickerUniPlugin.framework/Info.plist differ diff --git a/nativeplugins/VideoPicker/ios/VideoPickerUniPlugin.framework/VideoPickerUniPlugin b/nativeplugins/VideoPicker/ios/VideoPickerUniPlugin.framework/VideoPickerUniPlugin new file mode 100644 index 0000000..8305899 Binary files /dev/null and b/nativeplugins/VideoPicker/ios/VideoPickerUniPlugin.framework/VideoPickerUniPlugin differ diff --git a/nativeplugins/VideoPicker/package.json b/nativeplugins/VideoPicker/package.json index f918d2f..51d7bd4 100644 --- a/nativeplugins/VideoPicker/package.json +++ b/nativeplugins/VideoPicker/package.json @@ -30,6 +30,16 @@ "armeabi-v7a","arm64-v8a","x86" ], "minSdkVersion": "21" + }, + "ios": { + "plugins": [{ + "type": "module", + "name": "VideoPickerUniPlugin-VideoPickerModule", + "class": "VideoPickerModule" + }], + "frameworks": ["VideoPickerUniPlugin.framework"], + "integrateType": "framework", + "deploymentTarget": "11.0" } } } \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index 4f5e1b4..b3eda7a 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -138,28 +138,57 @@ commun.registerHandler('operateSQLite', async (data) => { }) commun.registerHandler('VideoPicker', async () => { - console.error("=======BASE==VideoPicker") - 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) - }, - ) + console.error('=======BASE==VideoPicker') + console.error(uni.getSystemInfoSync().osName) + if (uni.getSystemInfoSync().osName === 'ios') { + //调用IOS原生视频多选插件 + uni + .requireNativePlugin('VideoPickerUniPlugin-VideoPickerModule') + .pickVideos( + { maxCount: 9 }, + (res) => { + console.log('选中的视频列表:', res.videoList) + let allWebview = plus.webview.all() + allWebview.forEach((webview) => { + if (webview.id === 'chat') { + //找到聊天的webview + console.log('找到聊天的webview', webview) + webview.evalJS( + `getBaseMulVideo('${encodeURIComponent( + JSON.stringify(res.videoList), + )}')`, + ) + } + }) + }, + (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) + }, + ) + } }) // 获取电子名片