更新记录

1.0.1(2024-05-29)

优化iOS进度跳转时时长的返回。

1.0.0(2024-05-29)

初始化版本。


平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 3.6.8,Android:4.4,iOS:11 × × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × × × × × ×

概述

XF-notifiViewUTS封装了在Android和iOS中实现通知栏音乐播放器控制栏效果。

插件接口

addEventListener

监听通知栏播放器UI事件

uni-app项目中(vue/nvue)调用示例:

import { addEventListener } from "@/uni_modules/XF-notifiViewUTS"

addEventListener({
  complete: (res) => {
    console.log(res)
  }
});

uni-app x项目(uvue)中调用示例:

import { addEventListener } from "@/uni_modules/XF-notifiViewUTS";
import { EventListenerOptions } from "@/uni_modules/XF-notifiViewUTS/utssdk/interface.uts";

let options = {
  complete: (res : any) => {
    console.log(res)
  }
} as EventListenerOptions;
addEventListener(options);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

sendNotification

显示通知栏播放器UI

uni-app项目中(vue/nvue)调用示例:

import { sendNotification } from "@/uni_modules/XF-notifiViewUTS"

sendNotification({
  complete: (res) => {
        console.log(res)
  }
});

uni-app x项目(uvue)中调用示例:

import { sendNotification } from "@/uni_modules/XF-notifiViewUTS";
import { NotificationOptions } from "@/uni_modules/XF-notifiViewUTS/utssdk/interface.uts";

let options = {
    backgroundColor: '#FF3E96',
    songName: '我是歌曲' + new Date().getTime() + new Date().getTime() + new Date().getTime(),
    songNameStyle: {
        smallColor: '#FFE4C4',
        smallSize: 12,
        bigColor: '#FFE4C4',
        bigSize: 16,
    } as StyleOptions,
    //songSinger: '我是演唱者' + new Date().getTime() + new Date().getTime() + new Date().getTime(),
    songSingerStyle: {
        smallColor: '#FFE4C4',
        smallSize: 8,
        bigColor: '#FFE4C4',
        bigSize: 10,
    } as StyleOptions,
    songAlbum: 'https://mp-ebdfa47d-d79c-4b44-8224-3febec037f05.cdn.bspapp.com/uimusic_play_cover_pic_bg.png',
    isPlay: true,
  complete: (res : any) => {
    console.log(res)
  }
} as NotificationOptions;
sendNotification(options);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

cleanNotification

关闭通知栏播放器UI

uni-app项目中(vue/nvue)调用示例:

import { cleanNotification } from "@/uni_modules/XF-notifiViewUTS"

cleanNotification();

uni-app x项目(uvue)中调用示例:

import { cleanNotification } from "@/uni_modules/XF-notifiViewUTS";

cleanNotification();

可用性

Android系统

可提供的1.0.0及更高版本

setPlaybackTime

设置播放进度信息

uni-app项目中(vue/nvue)调用示例:

import { setPlaybackTime } from "@/uni_modules/XF-notifiViewUTS"

setPlaybackTime({
  duration : 1120,
  position : 20,
  complete: (res) => {
        console.log(res)
  }
});

uni-app x项目(uvue)中调用示例:

import { setPlaybackTime } from "@/uni_modules/XF-notifiViewUTS";
import { TimeOptions } from "@/uni_modules/XF-notifiViewUTS/utssdk/interface.uts";

let options = {
  duration : 1120,
  position : 20,
  complete: (res : any) => {
    console.log(res)
  }
} as TimeOptions;
setPlaybackTime(options);

可用性

iOS系统

可提供的1.0.0及更高版本

隐私、权限声明

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

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

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

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问