更新记录
1.0.1(2024-07-08)
1.0.0(2024-07-07)
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
HBuilderX 3.7.0,Android:5.0,iOS:12,HarmonyNext:不确定 |
× |
× |
× |
× |
× |
× |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
× |
× |
× |
× |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
× |
× |
× |
× |
× |
× |
× |
× |
× |
UTS环境兼容性
sn-alpha-player
封装AlphaPlayer, uts版本
使用
<template>
<view style="align-items: center">
<sn-alpha-player ref="aPlayer" style="width: 550rpx; height: 800rpx" @start="onStart" @end="onEnd" @monitor="onMonitor" />
<view style="width: 750rpx; padding: 20rpx">
<button type="primary" @click="start">播放</button>
<template v-if="playing">
<button type="default" @click="stop">停止</button>
</template>
</view>
</view>
</template>
<script>
export default {
data() {
return {
playing: false
};
},
onLoad() {},
methods: {
start() {
this.$refs['aPlayer'].start('/static/gift/demoRes', {
portrait: {
path: 'demo_video.mp4',
align: 8
},
landscape: {
path: 'demo_video.mp4',
align: 2
}
});
},
stop() {
this.$refs['aPlayer'].stop();
},
onMonitor(e) {
console.log('onMonitor', e.detail);
},
onStart() {
this.playing = true;
console.log('onStart');
},
onEnd() {
this.playing = false;
console.log('onEnd');
}
}
};
</script>
<style></style>
<template>
<!-- #ifdef APP -->
<scroll-view style="flex: 1">
<!-- #endif -->
<sn-alpha-player ref="aPlayer" style="width: 550rpx; height: 800rpx" @start="onStart" @end="onEnd" @monitor="onMonitor" />
<view style="width: 750rpx; padding: 20rpx">
<button type="primary" @click="start">播放</button>
<template v-if="playing">
<button type="default" @click="pause">暂停</button>
<button type="default" @click="resume">继续</button>
<button type="default" @click="stop">停止</button>
</template>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
import { PlayerConfig, ConfigItem } from '@/uni_modules/sn-alpha-player'
export default {
data() {
return {
playing: false
};
},
methods: {
start() {
let aPlayer = this.$refs['aPlayer'] as SnAlphaPlayerElement
aPlayer.start('/static/gift/demoRes', {
portrait: {
path: 'demo_video.mp4',
align: 8
} as ConfigItem,
landscape: {
path: 'demo_video.mp4',
align: 2
} as ConfigItem
} as PlayerConfig);
},
pause() {
let aPlayer = this.$refs['aPlayer'] as SnAlphaPlayerElement
aPlayer.pause();
},
resume() {
let aPlayer = this.$refs['aPlayer'] as SnAlphaPlayerElement
aPlayer.resume();
},
stop() {
let aPlayer = this.$refs['aPlayer'] as SnAlphaPlayerElement
aPlayer.stop();
},
onMonitor(e:Map<string,any>) {
console.log('onMonitor', e);
},
onStart() {
this.playing = true;
console.log('onStart');
},
onEnd() {
this.playing = false;
console.log('onEnd');
}
}
};
</script>
<style></style>