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/