标签:int 效果图 idg enc 类型 数字 win styles back
本文出自APICloud官方论坛vPlayer iOS封装了AVPlayer视频播放功能(支持音频播放)。iOS 平台上支持的视频文件格式有:WMV,AVI,MKV,RMVB,RM,XVID,MP4,3GP,MPG等,音频文件格式有:MP3,WMA,RM,ACC,OGG,APE,FLAC,FLV等。本模块封装了两套播放方案:一,通过调用 openPlayer 接口,直接打开一个自带默认播放界面的播放器;二,通过 open 接口,打开一个纯播放器界面,再配合 frame 自定义完整的播放页面,通过play、pause等接口控制播放操作。
效果图:
openPlayer示例代码:
var vPlayer = api.require(‘vPlayer‘);
vPlayer.openPlayer({
rect: {
x: 0, //(可选项)数字类型;模块左上角的 x 坐标(相对于所属的 Window 或 Frame);默认:0
y: 30, //(可选项)数字类型;模块左上角的 y 坐标(相对于所属的 Window 或 Frame);默认:0
w: api.frameWidth, //(可选项)数字类型;模块的宽度;默认:所属的 Window 或 Frame 的宽度
h: 300
},
path: ‘http://www.w3school.com.cn/example/html5/mov_bbb.mp4‘,
autoPlay: true,
coverImg: ‘widget://image/video/cover_img.png‘,
styles: {
head: {
bg: ‘rgba(161,161,161,0.4)‘,
height: 44,
marginTop: 0,
hide: false,
backBtn: { //ok
size: 32,
backImg: ‘widget://image/video/back.png‘,
marginLeft: 0
},
titleLabel: { //ok
title: ‘视频播放‘,
size: 16,
color: ‘#FFFFFF‘,
width: 170,
numberLines: 3,
leftMargin: 5,
// backgroundColor:‘rgba(161,161,161,0.4)‘
},
customButtons: [{
w: 32,
h: 32,
rightMagin: 5,
img: ‘widget://image/video/delete.png‘,
imgSelected: ‘widget://image/video/delete_sel.png‘,
}, ]
},
foot: {
bg: ‘rgba(161,161,161,0.4)‘,
height: 44,
marginBottom: 0,
hide: false,
playBtn: {
size: 32,
playImg: ‘widget://image/video/play.png‘,
pauseImg: ‘widget://image/video/pause.png‘,
marginLeft: 5
},
currentTimeLabel: {
textSize: 14,
textColor: "#FFFFFF",
marginLeft: 5
},
seekBar: {
sliderImg: ‘widget://image/video/seek_bar.png‘,
progressColor: ‘#FA8072‘,
progressSelectedColor: ‘#A2CD5A‘,
marginLeft: 5,
marginRight: 5
},
totalTimeLabel: {
textSize: 14,
textColor: "#FFFFFF",
marginRight: 5
},
fullScreenBtn: {
size: 32,
img: ‘widget://image/video/fullscreencal.png‘,
fullScreenImg: ‘widget://image/video/fullScreen.png‘,
marginRight: 10
}
}
},
fixedOn: api.frameName,
fixed: true
}, function(ret) {
if (ret) {
alert(JSON.stringify(ret));
}
});
复制代码
标签:int 效果图 idg enc 类型 数字 win styles back
原文地址:https://blog.51cto.com/9334358/2430799