close #161 support "addEvent" in any state

This commit is contained in:
Yanzhen Yu
2020-09-07 09:44:03 +08:00
parent 1bc5aaeb01
commit 9b8c7f755f
2 changed files with 17 additions and 1 deletions

View File

@@ -102,6 +102,10 @@ export function createPlayerService(
target: 'paused',
actions: ['resetLastPlayedEvent', 'pause'],
},
ADD_EVENT: {
target: 'playing',
actions: ['addEvent'],
},
},
},
paused: {
@@ -118,6 +122,10 @@ export function createPlayerService(
target: 'live',
actions: ['startLive'],
},
ADD_EVENT: {
target: 'paused',
actions: ['addEvent'],
},
},
},
live: {
@@ -232,6 +240,9 @@ export function createPlayerService(
},
delay: event.delay!,
});
if (!timer.isActive()) {
timer.start();
}
}
}
return { ...ctx, events };