引擎版本:
1.10.1
视频具体路径:
/var/mobile/Containers/Data/Application/E7D0AE83-9279-4577-89F9-051305738F2E/Documents/QYAds/20181106180055101487309.mp4
使用方法:
cc.loader.load(val,(err, res) => {
if (err) {
cc.log('load res from local path error '+err);
}else{
this.node.getChildByName('VideoPlayer').getComponent(cc.VideoPlayer).resourceType = cc.VideoPlayer.ResourceType.LOCAL;
this.node.getChildByName('VideoPlayer').getComponent(cc.VideoPlayer).clip = <cc.Asset>{nativeUrl:res};
}
}
其中res返回值/var/mobile/Containers/Data/Application/E7D0AE83-9279-4577-89F9-051305738F2E/Documents/QYAds/20181106180055101487309.mp4
报错信息:
ERROR: TypeError: url.indexOf is not a function. (In ‘url.indexOf(“http://”)’, ‘url.indexOf’ is undefined), location: script/ccui/jsb_cocos2d_ui.js:196:24
STACK:
setURL@script/ccui/jsb_cocos2d_ui.js:196:24
_updateVideoSource@src/jsb_polyfill.js:10077:24
set@src/jsb_polyfill.js:9989:38
src/project.dev.js:6983:82
src/project.dev.js:13327:81
src/jsb_polyfill.js:11939:38
src/jsb_polyfill.js:19407:21