提交 3d1667d1 编写于 作者: zhaofengliang920817's avatar zhaofengliang920817

iOS|修改音频格式示例。

上级 5c1c47ca
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
@click="play(item.src,index)"></image> @click="play(item.src,index)"></image>
</view> </view>
<view class="formats" v-for="(item,index) in notSupportFormats" :key="index"> <view class="formats" v-for="(item,index) in notSupportFormats" :key="index">
<text class="uni-subtitle-text">{{item.format}}(Android/web 不支持)</text> <text class="uni-subtitle-text">{{ item.format + (item.support) }}</text>
<image class="icon-play" :src="(isPlaying && playIndex==index)?'/static/pause.png':'/static/play.png'" <image class="icon-play" :src="(isPlaying && playIndex==index)?'/static/pause.png':'/static/play.png'"
@click="play(item.src,index)"></image> @click="play(item.src,index)"></image>
</view> </view>
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<script> <script>
type AudioFormat = { type AudioFormat = {
format : string format : string
support: string | null
src : string src : string
} }
export default { export default {
...@@ -55,31 +56,35 @@ ...@@ -55,31 +56,35 @@
format: 'flac', format: 'flac',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.flac' src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.flac'
}, },
{
format: 'ogg',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.ogg'
},
{ {
format: 'wav', format: 'wav',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.wav' src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.wav'
}, },
] as Array<AudioFormat>, ] as Array<AudioFormat>,
notSupportFormats: [ notSupportFormats: [
{
format: 'ogg',
support: '(iOS 不支持)',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.ogg'
},
{ {
format: 'wma', format: 'wma',
support: '(iOS/Android/web 不支持)',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.wma' src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.wma'
}, },
{ {
format: 'aiff', format: 'aiff',
support: '(Android/web 不支持)',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.aiff' src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.aiff'
}, },
{ {
format: 'caf', format: 'caf',
support: '(Android/web 不支持)',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.caf' src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.caf'
}, },
{ {
format: '错误格式', format: '错误格式',
support: '(iOS/Android/web 不支持)',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.wmaa' src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.wmaa'
}, },
] as Array<AudioFormat> ] as Array<AudioFormat>
...@@ -90,7 +95,7 @@ ...@@ -90,7 +95,7 @@
this._audioContext!.onPlay(() => { this._audioContext!.onPlay(() => {
console.log('开始播放'); console.log('开始播放');
}); });
this._audioContext!.onPause(()=>{ this._audioContext!.onPause(() => {
console.log('播放暂停'); console.log('播放暂停');
}) })
this._audioContext!.onEnded(() => { this._audioContext!.onEnded(() => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册