更新记录

1.0.1(2024-07-08)

  • 修复编译问题

1.0.0(2024-07-07)

  • 首发

平台兼容性

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

UTS环境兼容性

uni-app uni-app x

sn-alpha-player

封装AlphaPlayer, uts版本

使用

  • nvue
<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>
  • uvue
<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>

隐私、权限声明

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

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

插件不采集任何数据

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

暂无用户评论。

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