admin管理员组文章数量:1421009
I'm working on Facebook Spark Studio for the first time.
I wanted to do a marker based AR, like I usually do with Vuforia.
I wanted to play a mp4 video by scanning the a marker.
I read the Facebook AR studio docs, where they are supporting png and jpg file formats only.
Ref:
Are there any playback controls for external video texture?
Can any one help me to play a video on scanning a tracker?
I'm working on Facebook Spark Studio for the first time.
I wanted to do a marker based AR, like I usually do with Vuforia.
I wanted to play a mp4 video by scanning the a marker.
I read the Facebook AR studio docs, where they are supporting png and jpg file formats only.
Ref: https://developers.facebook./docs/ar-studio/before-you-start/file-formats
Are there any playback controls for external video texture?
Can any one help me to play a video on scanning a tracker?
Share Improve this question edited Oct 20, 2018 at 6:51 Subbu asked Oct 19, 2018 at 11:36 SubbuSubbu 6632 gold badges9 silver badges20 bronze badges2 Answers
Reset to default 2We had the same issue. The trick (or Facebook bug) is to set the url in the editor in the material with the link to your video. Then in your code do this:
const Scene = require('Scene');
const Animation = require('Animation');
const Materials = require('Materials');
const Textures = require('Textures');
const D = require('Diagnostics');
const Audio = require('Audio');
const animRoot = Scene.root.find('animRoot');
const planeTracker = Scene.root.find('planeTracker');
const targetMat = Materials.get('targetMat');
const externalText = Textures.get('externalAnimation');
const playbackController = Audio.getPlaybackController('playback_controller_model0');
planeTracker.confidence.eq('HIGH').onOn({fireOnInitialValue: true}).subscribe(function(e) {
playbackController.play();
externalText.url = '';
externalText.url = 'https://urlToYourVideo.mp4';
D.log('Tracking starts');
});
planeTracker.confidence.eq('HIGH').onOff({fireOnInitialValue: true}).subscribe(function(e) {
playbackController.stop();
externalText.url = '';
D.log('Tracking stops');
});
Hope this helps!
You can do that using an "External Texture" by linking a video texture that is hosted online.
- Create a material
- Under the material diffuse texture property choose "New External Texture"
- In the texture properties enter the URL for your video into the URL field
To use a tracker, look at the documentation for the PlaneTracker object: https://developers.facebook./docs/ar-studio/docs/plane-tracker/
本文标签: javascripthow to use mp4 videos as an external textures in Facebook AR studioStack Overflow
版权声明:本文标题:javascript - how to use mp4 videos as an external textures in Facebook AR studio? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745336938a2654083.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论