This article comes from APICloud official forum
UIBPlayer encapsulates Baidu Cloud Player SDK. UI module with the present embodiment, after opening a fully functional player interface. Baidu Cloud Player break out Android, iOS platform video format supports all major media formats (mp4, avi, wmv, flv, mkv, mov, rmvb, etc.).
Introduction module highlights:
- Comes UI, users simply design their own icon, adjust the parameters.
- With a double-click play, pause, gesture slide to change the playback progress, screen brightness and volume functions
-
iOS supports horizontal and vertical screen automatically switches (set in open vertical screen lock)
-
Automatically hide when the top, bottom button to play, click arouse.
- Before using an open platform to go Baidu get AccessKey, to config.xml configuration file, otherwise it will flash back and other abnormalities. Reference module documentation.
- Directly call open interfaces to open the player. code show as below:
var UIBPlayer = api.require('UIBPlayer');
UIBPlayer.open({
rect: {
x: 0,
y: 0,
w: api.winWidth,
h: 300
},
videoScalingMode:"FIT_WITH_CROPPING",
path: 'http://wvideo.spriteapp.cn/video/2016/0328/56f8ec01d9bfe_wpd.mp4',
autoPlay: false,
enableLooping: true,
pauseInBackground: true,
coverImg: 'widget://image/uibplayer/cover.png',
styles: {
head: {
bg: 'rgba(161,161,161,0.5)',
height: 44,
marginTop: api.safeArea.top,
hide: false,
backBtn: {
size: 30,
backImg: 'widget://image/uibplayer/back.png',
marginLeft: 5
},
titleLabel: {
title: '蝙蝠侠',
size: 20,
color: '#fff',
width: 200,
numberLines: 1,
leftMargin: 5,
backgroundColor: 'rgba(0,0,0,0)'
},
customButtons: [{
w: 30,
h: 30,
rightMagin: 5,
img: 'widget://image/uibplayer/setting.png',
imgSelected: 'widget://image/uibplayer/settinged.png',
}, {
w: 30,
h: 30,
rightMagin: 5,
img: 'widget://image/uibplayer/mess.png',
imgSelected: 'widget://image/uibplayer/messed.png',
}]
},
foot: {
bg: 'rgba(161,161,161,0.5)',
height: 44,
marginBottom: 0,
hide: false,
playBtn: {
size: 44,
playImg: 'widget://image/uibplayer/play.png',
pauseImg: 'widget://image/uibplayer/pause.png',
marginLeft: 0
},
currentTimeLabel: {
textSize: 14,
textColor: "#FFF",
marginLeft: 5
},
seekBar: {
sliderImg: 'widget://image/uibplayer/slide.png',
progressColor: '#696969',
progressSelectedColor: '#333333',
marginLeft: 5,
marginRight: 5
},
totalTimeLabel: {
textSize: 14,
textColor: "#FFF",
marginRight: 5
},
fullScreenBtn: {
size: 30,
img: 'widget://image/uibplayer/unfullscreen.png',
fullScreenImg: 'widget://image/uibplayer/fullscreen.png',
marginRight: 10
}
}
},
fixedOn: api.frameName,
fixed: false
});
Copy the code
Different users need to Baidu open platform application key, configured to config.xml own project, submit the code and then compile a custom loader.
Reproduced in: https: //blog.51cto.com/9334358/2406968