Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
f41eb0c7
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5992
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
f41eb0c7
编写于
11月 18, 2024
作者:
W
wanganxp
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
web端屏蔽音频播放和uni-icon字体不支持的部分
上级
eb13c34c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
80 addition
and
66 deletion
+80
-66
pages/API/create-inner-audio-context/create-inner-audio-context.uvue
...reate-inner-audio-context/create-inner-audio-context.uvue
+14
-14
pages/API/create-inner-audio-context/inner-audio-path.uvue
pages/API/create-inner-audio-context/inner-audio-path.uvue
+64
-52
pages/CSS/text/font-family.uvue
pages/CSS/text/font-family.uvue
+2
-0
未找到文件。
pages/API/create-inner-audio-context/create-inner-audio-context.uvue
浏览文件 @
f41eb0c7
...
...
@@ -26,7 +26,7 @@
<boolean-data :defaultValue="false" title="是否自动开始播放" @change="setAutoplay"></boolean-data>
<boolean-data :defaultValue="false" title="是否循环播放" @change="setLoop"></boolean-data>
<text class="uni-subtitle-text uni-title"
style="padding-left: 10px;padding-top: 10px;padding-right: 10px;">播放倍率</text>
style="padding-left: 10px;padding-top: 10px;padding-right: 10px;">播放倍率
(Web不支持)
</text>
<radio-group class="uni-flex uni-row radio-group" @change="playbackRateChange"
style="flex-wrap: wrap;padding: 10px;">
<radio value="0.5" style="margin-right: 3px">0.5
...
...
@@ -41,30 +41,30 @@
<view class="uni-title">
<text class="uni-title-text">方法示例</text>
</View>
<button :disabled="isPlaying"
type="primary"
@click="play" class="uni-btn">播放</button>
<button :disabled="!isPlaying"
type="primary"
@click="pause" class="uni-btn">暂停</button>
<button :disabled="!isPlaying"
type="primary"
@click="stop" class="uni-btn">停止</button>
<button
type="primary"
@click="onchangeValue(20)" class="uni-btn">跳转到指定位置20</button>
<button
type="primary"
@click="onTimeUpdate" class="uni-btn">onTimeUpdate</button>
<button
type="primary"
@click="offTimeUpdate" class="uni-btn">offTimeUpdate</button>
<button
type="primary"
@click="onWaiting" class="uni-btn">onWaiting</button>
<button
type="primary"
@click="offWaiting" class="uni-btn">offWaiting</button>
<button :disabled="isPlaying" @click="play" class="uni-btn">播放</button>
<button :disabled="!isPlaying" @click="pause" class="uni-btn">暂停</button>
<button :disabled="!isPlaying" @click="stop" class="uni-btn">停止</button>
<button @click="onchangeValue(20)" class="uni-btn">跳转到指定位置20</button>
<button @click="onTimeUpdate" class="uni-btn">onTimeUpdate</button>
<button @click="offTimeUpdate" class="uni-btn">offTimeUpdate</button>
<button @click="onWaiting" class="uni-btn">onWaiting</button>
<button @click="offWaiting" class="uni-btn">offWaiting</button>
<text style="color: red;font-size: 15px;margin-top: 10px;">tip:销毁后请重新进入此界面再播放</text>
<button
type="primary"
@click="destory" class="uni-btn">销毁</button>
<button @click="destory" class="uni-btn">销毁</button>
<view class="uni-title">
<text class="uni-title-text">格式/路径示例</text>
</View>
<navigator url="/pages/API/create-inner-audio-context/inner-audio-format" class="uni-btn">
<button
type="primary"
@click="pause">音频格式示例</button>
<button @click="pause">音频格式示例</button>
</navigator>
<navigator url="/pages/API/create-inner-audio-context/inner-audio-path" class="uni-btn">
<button
type="primary"
@click="pause">音频路径示例</button>
<button @click="pause">音频路径示例</button>
</navigator>
<navigator url="/pages/API/create-inner-audio-context/inner-audio-mult" class="uni-btn">
<button
type="primary"
@click="pause">多音频同时播放</button>
<button @click="pause">多音频同时播放</button>
</navigator>
</view>
<!-- #ifdef APP -->
...
...
pages/API/create-inner-audio-context/inner-audio-path.uvue
浏览文件 @
f41eb0c7
<template>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<!-- #ifdef APP -->
<scroll-view style="flex: 1;">
<!-- #endif -->
<view class="uni-title">
<text class="uni-title-text">音频路径示例</text>
</view>
...
...
@@ -9,7 +10,9 @@
<image class="icon-play" :src="(isPlaying && playIndex==index)?'/static/pause.png':'/static/play.png'"
@click="play(item.src,index)"></image>
</view>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
...
...
@@ -20,11 +23,14 @@
export default {
data() {
return {
title: 'audio-path',
playIndex: 0,
isPlaying: false,
nativePath:uni.env.CACHE_PATH+'uni-audio/test/test.mp3' as string,
sdcardPath :'sdcard/uni-audio/test.mp3',
// #ifdef APP
nativePath: uni.env.CACHE_PATH + 'uni-audio/test/test.mp3' as string,
// #endif
// #ifdef APP-ANDROID
sdcardPath: 'sdcard/uni-audio/test.mp3',
// #endif
_audioContext: null as InnerAudioContext | null,
supportPaths: [
{
...
...
@@ -35,10 +41,12 @@
description: '本地路径:../static/',
src: '../../../static/test-audio/ForElise.mp3'
},
// #ifdef APP
{
description: '本地路径:env方式',
src: 'env'
},
// #endif
{
description: '网络路径',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.mp3'
...
...
@@ -68,22 +76,24 @@
console.log('err', err);
});
// #ifdef APP
const fileManager = uni.getFileSystemManager()
try {
fileManager.rmdirSync(uni.env.CACHE_PATH+'uni-audio/test',true)
fileManager.rmdirSync(uni.env.CACHE_PATH + 'uni-audio/test', true)
} catch (e) {
}
try {
fileManager.mkdirSync(uni.env.CACHE_PATH+'uni-audio/test',true)
fileManager.mkdirSync(uni.env.CACHE_PATH + 'uni-audio/test', true)
} catch (e) {
}
try{
try {
fileManager.copyFileSync(
'/static/test-audio/ForElise.mp3',
this.nativePath)
} catch(e){
} catch (e) {
}
// #endif
},
onUnload() {
...
...
@@ -97,15 +107,17 @@
this._audioContext!.pause();
this.isPlaying = false;
},
play(audioUrl
:string, index:
number) {
console.log(index,audioUrl);
play(audioUrl
: string, index :
number) {
console.log(index,
audioUrl);
if (this.isPlaying && this.playIndex == index) {
this.pause();
return;
}
if(audioUrl == 'env'){
audioUrl=this.nativePath
// #ifdef APP
if (audioUrl == 'env') {
audioUrl = this.nativePath
}
// #endif
this.playIndex = index
this._audioContext!.src = audioUrl;
...
...
pages/CSS/text/font-family.uvue
浏览文件 @
f41eb0c7
...
...
@@ -8,9 +8,11 @@
<!-- <text class="common" style="font-family: AlimamaDaoLiTiWOFF">font-family: 阿里妈妈刀隶体-woff</text>
<text class="common" style="font-family: AlimamaDaoLiTiWOFF2">font-family: 阿里妈妈刀隶体-woff2</text> -->
</view>
<!-- #ifdef APP -->
<view style="margin: 24px 12px;">
<button type="default" @click="openUniIcon">内置字体图标uni-icon示例</button>
</view>
<!-- #endif -->
</template>
<script lang="uts">
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录