更新记录

1.0.0(2025-12-31)

发布插件 内容参考 readme


平台兼容性

uni-app x(4.87)

Chrome Safari Android Android插件版本 iOS iOS插件版本 鸿蒙 鸿蒙插件版本 微信小程序
× × 12.0 1.0.0 12 1.0.0 15 1.0.0 ×

lcy-importAudio

获取外部分享包括(微信、系统)

使用方式

引入工程

import { getSharedFilePath, clearSharedFilePath } from '@/uni_modules/lcy-importAudio'

安卓需要打包自定义基座

配置manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <application>
        <!-- 分享入口 Activity -->
        <activity
            android:name="io.dcloud.uniapp.UniAppActivity"
                android:exported="true"
                android:launchMode="singleTop"
                android:taskAffinity="输入包名"
                >
            <!-- 分享单文件 -->
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="audio/*" />
            </intent-filter>
            <!-- 打开文件(VIEW) -->
            <intent-filter>
                <data android:scheme="file" />
                <data android:scheme="content" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:mimeType="audio/*" />
            </intent-filter>

        </activity>

    </application>

</manifest>

鸿蒙需要配置 harmony-configs -> entry -> src -> main -> module.json5

{
  "module": {
    "name": "entry",
    "type": "entry",
    "description": "$string:module_desc",
    "mainElement": "EntryAbility",
    "deviceTypes": [
      "phone"
    ],
    "deliveryWithInstall": true,
    "installationFree": false,
    "pages": "$profile:main_pages",
    "querySchemes": [
          "weixin",
          "wxopensdk"
    ],
    "abilities": [
      {
        "name": "EntryAbility",
        "srcEntry": "./ets/entryability/EntryAbility.ets",
        "description": "$string:EntryAbility_desc",
        "icon": "$media:layered_image",
        "orientation":"portrait",
        "label": "$string:EntryAbility_label",
        "startWindowIcon": "$media:startIcon",
        "startWindowBackground": "$color:start_window_background",
        "exported": true,
        "backgroundModes": ["audioRecording"],
        "skills": [
            {
              "entities": [
                "entity.system.home"
              ],
              "actions": [
                     "wxentity.action.open",
              ]
            },
          {
            "entities": [
              "entity.system.home"
            ],
            "actions": [
              "action.system.home",
              "wxentity.action.open",
              "ohos.want.action.sendData"
            ],
            "uris": [
                {
                  "scheme": "file", 
                  "utd": "general.audio",
                  "maxFileSupported": 1
                }
            ]
          }
        ]
      }
    ],
    "requestPermissions": [
      {
        "name": "ohos.permission.INTERNET"
      },
      {
        "name":"ohos.permission.KEEP_BACKGROUND_RUNNING"
      },
      {
        "name": "ohos.permission.MICROPHONE",
        "reason": "$string:module_desc",
        "usedScene": {
          "abilities": [
            "EntryAbility"
          ],
          "when": "always"
        }
      }
    ]
  }
}

ios需要配置plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
        <key>CFBundleDocumentTypes</key>
        <array>
            <dict>
                <key>CFBundleTypeName</key>
                <string>Audio File</string>
                <key>LSHandlerRank</key>
                <string>Alternate</string>
                <key>LSItemContentTypes</key>
                <array>
                    <string>com.apple.m4a-audio</string>
                    <string>public.mpeg-4-audio</string>
                    <string>public.aac-audio</string>
                    <string>org.xiph.flac</string>
                    <string>com.microsoft.waveform-audio</string>
                    <string>public.mp3</string>
                </array>
            </dict>
        </array>
        <key>LSSupportsOpeningDocumentsInPlace</key>
        <true/>
  </dict>
</plist>

三端方法一致

getSharedFilePath

自动获取分享文件路径

clearSharedFilePath

清除临时卢金

注意 目前安卓ios 只能获取audio类型,其他类型需求自行更改即可。请试用后、满足需求后在购买!!

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。