Skip to content

Commit

Permalink
feat: add canplay event
Browse files Browse the repository at this point in the history
  • Loading branch information
xiabaoying authored and ambar committed Oct 13, 2021
1 parent 12b4d6b commit aede72f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/griffith-message/README-zh-Hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ dispatchMessage(target: Window, name: ACTIONS, data?: object): void
| `messageName` | 说明 | `data` |
| --------------------------- | ---------------------------------- | ------------------------------------------------ |
| `EVENTS.CANPLAY` | 可播放 | 见下表 |
| `EVENTS.PLAY` | 播放 | 见下表 |
| `EVENTS.PLAYING` | 从暂停或缓冲中恢复播放 | 见下表 |
| `EVENTS.PAUSE` | 暂停 | 见下表 |
Expand Down
1 change: 1 addition & 0 deletions packages/griffith-message/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Events received from the player
| `messageName` | Description | `data` |
| --------------------------- | ------------------------------------ | ------------------------------------------------ |
| `EVENTS.CANPLAY` | canplay | see DOM type data table |
| `EVENTS.PLAY` | Play | see DOM type data table |
| `EVENTS.PLAYING` | Resume playback from pause or buffer | see DOM type data table |
| `EVENTS.PAUSE` | Pause | see DOM type data table |
Expand Down
2 changes: 2 additions & 0 deletions packages/griffith-message/src/constants/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ enum DOM {
TIMEUPDATE = 'event/dom/timeupdate',
ERROR = 'event/dom/error',
WAITING = 'event/dom/waiting',
CANPLAY = 'event/dom/canplay',
}

// custom events
Expand Down Expand Up @@ -68,6 +69,7 @@ export type EventParamsMap = {
[EVENTS.PAUSE]: Listen<DOMEventParams>
[EVENTS.ENDED]: Listen<DOMEventParams>
[EVENTS.TIMEUPDATE]: Listen<DOMEventParams>
[EVENTS.CANPLAY]: Listen<DOMEventParams>
[EVENTS.ERROR]: Listen<DOMEventParams>
[EVENTS.WAITING]: Listen<DOMEventParams>
[EVENTS.QUALITY_CHANGE]: Listen<{quality: Quality; prevQuality: Quality}>
Expand Down
1 change: 1 addition & 0 deletions packages/griffith/src/components/VideoWithMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const eventMap: EventPair[] = [
[EVENTS.TIMEUPDATE, 'onTimeUpdate'],
[EVENTS.ERROR, 'onError'],
[EVENTS.WAITING, 'onWaiting'],
[EVENTS.CANPLAY, 'onCanPlay'],
]

function serializeDOMException(exception?: MediaError | null) {
Expand Down

0 comments on commit aede72f

Please sign in to comment.