CodePen view

Using playlists, it's possible to apply a background sound track to each scene.

configuration.json

{
    "playlists":
    {
        "volume":
        {
            "default": 0.5,
            "max": 1.0
        },

        "default": "playlist-0",

        "lists":
        [
            {
                "uid": "playlist-0",
                "name": "Playlist #1",
                "default": "track-0",

                "tracks": ["track-0", "track-1"]
            },

            {
                "uid": "playlist-1",
                "name": "Playlist #2",
                "default": "track-2",

                "tracks": ["track-2", "track-3"]
            }
        ],

        "tracks":
        [
            {
                "uid": "track-0",
                "author": "TinyWorlds",
                "name": "Forest Ambience",
                "url": "Forest_Ambience.mp3"
            },

            {
                "uid": "track-1",
                "author": "Écrivain",
                "name": "Nature Comes",
                "url": "nature_comes_sharp.ogg"
            },

            {
                "uid": "track-2",
                "author": "cynicmusic",
                "name": "Battle theme A",
                "url": "battleThemeA.mp3"
            },

            {
                "uid": "track-3",
                "author": "Sudocolon",
                "name": "Space Ace",
                "url": "Logisector Intro.mp3"
            }
        ]
    },

    "story":
    {
        "uid": "playlist-story",
        "name": "Audio Playlists Story",
        "slug": "playlist-story",
        "description": "This is a demonstration of audio playlists applied to the scenes",
        "default": "scene-1",

        "scenes":
        [
            {
                "uid": "scene-1",
                "name": "First scene",
                "slug": "first-scene",
                "description": "This is the first scene",

                "media":
                {
                    "uid": "media-1",
                    "type": "image",

                    "source":
                    {
                        "format": "equi",
                        "url": "01-forest.jpg"
                    }
                }
            },

            {
                "uid": "scene-2",
                "name": "Second scene",
                "slug": "second-scene",
                "description": "This is the second and last scene",

                "media":
                {
                    "uid": "media-2",
                    "type": "image",

                    "source":
                    {
                        "format": "equi",
                        "url": "03-snow.jpg"
                    }
                },

                "playlists":
                {
                    "default": "playlist-1"
                }
            }
        ]
    },

    "actions":
    [
        {
            "uid": "action-next-track",
            "target": "viewer.playlists",

            "method":
            {
                "name": "nextTrack"
            }
        }
    ],

    "plugins":
    {
        "prefix": "../../plugins/",

        "engines":
        [
            {
                "uid": "org.forgejs.simplebutton",
                "url": "SimpleButton/"
            },

            {
                "uid": "org.forgejs.previousnextbuttons",
                "url": "PreviousNextButtons/"
            }
        ],

        "instances":
        [
            {
                "uid": "simplebutton-next-track",
                "engine": "org.forgejs.simplebutton",

                "options":
                {
                    "bottom": 10,
                    "right": 10,
                    "width": 100,
                    "height": 50,
                    "value": "Next track"
                },

                "events":
                {
                    "onClick": ["action-next-track"]
                }
            },

            {
                "uid": "previousnextbuttons",
                "engine": "org.forgejs.previousnextbuttons"
            }
        ]
    }
}

Back to samples

3rd Jan 2017