0.0.13 • Published 22 hours ago

ali-swiper v0.0.13

Weekly downloads
-
License
-
Repository
-
Last release
22 hours ago

AliSwiper:增强的快应用 swiper 插件

使用方式

<import name="ali-swiper" src="/node_modules/ali-swiper/dist-npm/aliswiper.bundle.ux"></import>
<template>
    <ali-swiper id="ali-swiper-sdk" play-list="{{playList}}" initial-index="0"> <ali-swiper/>
</template>
<script>
    export default {
        private: {
            playList: [
                { type: 'video', url: 'https://xxx', relatedList: [{ url: '' }] },
                { type: 'video', url: 'https://xxx', relatedList: [{ url: '' }] }
            ]
        }
    }
</script>

参数

proptypeexplanationdefault value
play-listArray|playItem[]playItem: { url: string, relatedList: { url: string } }播放列表数组参数platList,是一个由playItem组成的数组。playItem结构包含两个变量:url与relatedList。url是每个视频的播放地址,string类型,必选参数。relatedList用于页面跳转时的预加载优化,数组类型,非必选参数。数组项为Object类型,仅包含一个名为url的string类型变量,形如:{ url: 'xxx' }举例,传入如下playList 到 'play-list' prop中playList = [ { url: 'https://video1-1.mp4', relatedList: { url: 'https://video1-2.mp4' } }, { url: 'https://video2-1.mp4', relatedList: { url: 'https://video2-2.mp4' } }]此时,会生成长度为2的滑动列表,播放'video1-1.mp4'与'video2-1.mp4'。当播放'video1-1.mp4'时,ali-swiper会自动预加载下一个视频'video2-1.mp4'。当视频'video1-1.mp4'播放进度接近完成时,ali-swiper会额外预加载relatedList传入的'video1-2.mp4',以备页面跳转之需。页面跳转后,重新初始化ali-swiper,如果此时播放的首个视频是'video1-2.mp4',首帧速度体验将得到保证。[]
initial-indexnumber|string0 | '0'播放列表初始位置(序号index)。仅支持初始化时传入,后续将由SDK内部管理。如果需要主动切换当前播放的视频,请使用方法swipeTo(index)。0
play-mode'auto-play-next'字符串枚举类型,目前仅支持'auto-play-next'表示播放完成时,自动播放下一集,传入其他则无效。''
debugboolean是否开启debug模式,开启后ali-swiper界面会显示当前视频与预加载视频等信息,帮助开发调试。false
reach-top-textstring滑动到顶部时的提示文案'已经滑到顶啦~'
reach-bottom-textstring滑动到底部时的提示文案'已经滑到底啦~'
play-failed-hint-textstring播放出错时的提示文案'网络不好...请重试'
licensestring49位的licenseKey''

方法

NameParamsexplanation
swipeToindex: number将ali-swiper切换到第index视频进行播放。

事件

EventParamsexplanation
changeindex: number当前视频发生变化时触发,index表示当前视频序号。
reach-topindex: number滑动到顶部时触发,index表示当前视频序号。
reach-bottomindex: number滑动到顶部时触发,index表示当前视频序号。
canplayindex: number当前视频缓冲到可播放时触发,index表示当前视频序号。
playindex: number视频开始播放时触发,包括暂停后再次播放,index表示当前视频序号。
pauseindex: number视频暂停时触发,index表示当前视频序号。
timeupdateindex: number, currentTime: number视频播放进度发生变化时触发,index表示当前视频序号,currentTime表示当前播放时长。
endedindex: number视频播放完成时触发,index表示当前视频序号。
0.0.12

22 hours ago

0.0.13

22 hours ago

0.0.11

2 months ago

0.0.10

2 months ago

0.0.9

2 months ago

0.0.8

2 months ago

0.0.7

4 months ago

0.0.6

5 months ago

0.0.5

5 months ago

0.0.4

5 months ago

0.0.3

5 months ago