Creating a Dynamic Story

String prjuid = "project UID for this story";

FXTemplateClient tmpl = FXTemplateClient.builder()
        .withProvider(new StaticCredentialsProvider("apikey", "apisecret"))
        .withRegion(Regions.EU_WEST_1)
        .build();

DynamicStory story = new DynamicStory()
        .addBackgroundSound(new LocalAudioResource("backgroundsound.wav"))

        .addScene(new FixedScene()
                .setName("Intro Scene")
                .setVisual(new LocalVideoResource("001.mov"))
                .addAudio(new LocalAudioResource("Intro.mp3").setFadein(25)))
        
        .addScene(new ChoiceScene("key")
                .setName("key-is-either-a-or-b")
                .addVariant(new SceneVariant("a")
                        .setVisual(new LocalVideoResource("001.mov"))
                        .addAudio(new LocalAudioResource("sound1.wav").setFadeout(30)))
                .addVariant(new SceneVariant("b")
                        .setVisual(new LocalVideoResource("002.mov"))
                        .addAudio(new LocalAudioResource("sound2.mp3"))))

        .addScene(new OptionalScene("play-maybe")
                .setVisual(new MovieResource(tmpl.getMovieDefinition(prjuid, "other-template"), 0)))

        .addScene(new FixedScene()
                .setVisual(new HTTPVideoResource("https://cdn.impossible.io/test/test.mp4")))

        .addScene(new FixedScene()
                .setVisual(new LocalVideoResource(new NameTemplate("${clip}.mov"))))

        .addScene(new FixedScene()
                .setVisual(new LocalVideoResource("outro.mov"))
                .addAudio(new Silence(25))
                .addAudio(new LocalAudioResource("outro.mp3").setFadeout(25)));

FXProto.Movie m = story.CreateMovie(640, 360, 25, 1);
String result = tmpl.createTemplate(prjuid, "teststory", m.toByteArray());
System.out.println(result);        

Terms of Use | © 2017, Impossible Software, or its affiliates. All rights reserved.