Created
October 6, 2021 17:38
-
-
Save franciscoaguirre/d84667c92b68d47d9379494f618e6e38 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const encoderStates = { | |
| initial: 'streaming', | |
| states: { | |
| streaming: { | |
| on: { | |
| ENCODER_STOPPED: 'paused', | |
| }, | |
| }, | |
| paused: { | |
| on: { | |
| ENCODER_RESUMED: 'streaming', | |
| }, | |
| }, | |
| }, | |
| }; | |
| const browserStates = { | |
| initial: 'processing', | |
| states: { | |
| processing: { | |
| on: { | |
| PROCESSED: 'streaming', | |
| }, | |
| }, | |
| streaming: { | |
| on: { | |
| PAUSE: 'paused', | |
| ERROR: 'error', | |
| }, | |
| }, | |
| paused: { | |
| on: { | |
| GO_LIVE: 'streaming', | |
| }, | |
| }, | |
| error: { | |
| on: { | |
| GO_LIVE: 'streaming', | |
| }, | |
| }, | |
| }, | |
| }; | |
| const livestreamMachine = Machine({ | |
| id: 'livestream-hierarchical', | |
| type: 'parallel', | |
| states: { | |
| stage: { | |
| initial: 'browserCanStream', | |
| states: { | |
| browserCanStream: { | |
| on: { | |
| GO_LIVE: 'browser', | |
| FROM_ENCODER: 'encoderProcessing', | |
| END: 'completed', | |
| }, | |
| }, | |
| encoderProcessing: { | |
| on: { | |
| PROCESSED: 'encoderCanStream', | |
| FROM_BROWSER: 'browserCanStream', | |
| END: 'completed', | |
| }, | |
| }, | |
| encoderCanStream: { | |
| on: { | |
| ENCODER_STARTED: 'encoder', | |
| FROM_BROWSER: 'browserCanStream', | |
| }, | |
| }, | |
| encoder: { | |
| on: { | |
| ERROR: 'error', | |
| END: 'completed', | |
| }, | |
| ...encoderStates, | |
| }, | |
| browser: { | |
| on: { | |
| END: 'completed', | |
| }, | |
| ...browserStates, | |
| }, | |
| error: { | |
| type: 'final', | |
| }, | |
| completed: { | |
| type: 'final', | |
| }, | |
| }, | |
| }, | |
| type: { | |
| initial: 'test', | |
| states: { | |
| test: { | |
| on: { | |
| EVENT: 'event', | |
| }, | |
| }, | |
| event: { | |
| type: 'final', | |
| }, | |
| }, | |
| }, | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment