|
你好,我遇到一个问题,app端要从一个视频的随机位置播放。写了安卓的可以,但是苹果的有问题,回一直随机的跳,不能正常播放。open这个方法貌似不止打开视频一次呢,或者是分三次打开的 第一次eventype是show,然后playing,再然后是show,但是苹果的好像是一直在打开,所以一直随机的跳。
- /**
- * 根据视频总秒数 随机播放
- * @param ret
- */
- var func = function (ret) {
- var ltime = ret ? Math.floor(Math.random() * ret) : 0;
- // alert(ltime);
- videoPlayer.seekTo({
- seconds: ltime
- });
- api.setFrameAttr({
- name: 'live_camera',
- hidden: false
- });
- }
- /**
- * 区分ios还是安卓
- */
- if (api.systemType == 'ios') {
- videoPlayer.open({
- path: api.pageParam.videoURL,
- scalingMode: 'scaleToFill',
- fixedOn: 'live_camera_1',
- rect: {
- x: 0,
- y: 0,
- w: api.winWidth,
- h: api.winHeight
- },
- }, function (ret, err) {
- if (ret.status && ret.duration) {
- func(ret.duration);
- }
- });
- } else {
- //安卓
- videoPlayer.open({
- path: api.pageParam.videoURL,
- scalingMode: 'scaleToFill',
- fixedOn: 'live_camera_1',
- rect: {
- x: 0,
- y: 0,
- w: api.winWidth,
- h: api.winHeight
- },
- }, function (ret, err) {
- if (ret.status && ret.duration) {
- func(ret.duration);
- }
- });
- }
复制代码 |
|