Scene Transitions Module
Required Permissions: slobs.scene-transitions
This module can be used to create scene transitions. It's useful for apps to provide both editable and uneditable transitions for the streamer.
StingerTransitionOptions object
object
Property | Type | Description |
---|---|---|
type | 'stinger' | Transition type. |
name | string | The name of the transition. |
url | string | A URL to a video asset. If no protocol is provided in the URL, then it is assumed to be relative, and refers to a location within your application bundle. If a protocol is provided, then the asset is assumed to be outside your app, and the domain must be included in the mediaDomains list in your application manifest. |
audioFadeStyle | string? | How the audio should fade: 'fadeOut' or 'crossFade' . Defaults to 'fadeOut' . |
shouldLock | boolean? | If set to true , the scene transition won't be editable by end-users after being created. Defaults to false . |
shouldMonitorAudio | boolean? | Whether to monitor audio. Defaults to false . |
transitionPoint | number? | A transition point in milliseconds. |
transitionPointType | 'time' | 'frame' | Type of transition point. |
Transition object
object
Property | Type | Description |
---|---|---|
id | string | A unique ID for the transition. |
name | string | Name of the transition. |
type | string | Transition type. For now, app developers should expect this to be stinger . |
duration | number | Transition duration. Not supported for stinger transitions. You should ignore this value. |
TransitionConnection object
object
Property | Type | Description |
---|---|---|
id | string | Unique ID for the connection. |
transitionId | string | Unique ID of the transition that gets applied. |
fromSceneId | string | Unique ID for the originating scene. |
toSceneId | string | Unique ID for the target scene. |
createTransition method
method
createTransition: () => Promise<Transition>
Creates a scene transition. Currently, only stinger transitions are supported, as these are the most useful for customization.
Arguments
options
: A description of transition options. SeeTransitionOptions
andStingerTransitionOptions
.
Returns
Promise<Transition>
Example
streamlabsOBS.v1.SceneTransitions.createTransition({
type: 'stinger',
name: 'My Cool Stinger',
url: 'cool-stinger.mp4',
shouldLock: true,
});
getTransitions method
method
getTransitions: () => Promise<Array<Transition>>
Get a list of scene transitions.
This includes all transitions the user has set up in SLOBS. To only retrieve transitions managed by this App use getAppTransitions
.
Arguments
None
Returns
Promise<Transition[]>
Example
streamlabsOBS.v1.SceneTransitions.getTransitions()
.then(transitions => transitions.map(t => t.id));
getAppTransitions method
method
getAppTransitions: () => Promise<Array<Transition>>
Get a list of scene transitions belonging to this App.
Arguments
None
Returns
Promise<Transition[]> - A list of Transition objects belonging to the current App.
Example
streamlabsOBS.v1.SceneTransitions.getAppTransitions()
.then(transitions => transitions.map(t => t.id));
deleteTransition method
method
deleteTransition: (transitionId: string) => Promise<boolean>
Delete a specific transition by ID.
Arguments
transitionId
: ID of the transition to be deleted.
Returns
true
if the transition was successfully deleted.
Example
const transitionId = ...;
streamlabsOBS.v1.SceneTransitions.deleteTransition(transitionId)
.then(() => /* handle success */)
.catch(e => /* handle error */)
setDefaultTransition method
method
setDefaultTransition: (transitionId: string) => Promise<boolean>
Set a transition as the default scene transition.
Arguments
transitionId
: ID of the transition to be set as default
Returns
true
if setting the transition as default succeeded.
Example
const transitionId = ...;
streamlabsOBS.v1.SceneTransitions.setDefaultTransition(transitionId)
.then(() => /* handle success */)
.catch(e => /* handle error */)
createConnection method
method
createConnection: (transitionId: string, fromSceneId: string, toSceneId: string) => Promise<TransitionConnection>
Create a scene transition connection between scenes.
See getScenes on the Scene module for information on how to retrieve scene IDs.
Arguments
transitionId
: ID of the transition to connectfromSceneId
: Originating scene IDtoSceneId
: Target scene ID
Returns
A TransitionConnection object.
Examples
Basic
const fromSceneId = ...;
const toSceneId = ...;
const transitionId = ...;
streamlabsOBS.v1.SceneTransitions.createConnection(
transitionId,
fromSceneId,
toSceneId
)
.then(conn => /* handle success */)
.catch(e => /* handle error */)
Connect the first and second scenes with a transition
// Connect the first and second scenes with a transition (no error handling)
const transitionId = ...;
streamlabsOBS.v1.SceneTransitions.getScenes()
.then(scenes => [scenes[0].id, scenes[1].id])
.then(([fromSceneId, toSceneId]) => {
return streamlabsOBS.v1.SceneTransitions.createConnection(
transitionId,
fromSceneId,
toSceneId,
)
})
getConnections method
method
getConnections: () => Promise<Array<TransitionConnection>
Get a list of scene connections.
Arguments
None.
Returns
A list of all connections between scenes.
Examples
streamlabsOBS.v1.SceneTransitions.getConnections().then(connections => {
// Do something with connections.
})
deleteConnection method
method
deleteConnection: (transitionId: string) => Promise<boolean>
Delete a scene transition connection.
Arguments
connectionId
: ID of the connection to be deleted
Returns
true
if the connection was successfully deleted.
Examples
const connectionId = ...;
streamlabsOBS.v1.SceneTransitions.deleteConnection(connectionId)
.then(() => /* handle success */)
.catch(e => /* handle error */);
Updated over 5 years ago