Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR modifies the type handling for video data reception from AnimationTool by updating the videoData property type to allow null values and adjusting the corresponding usage to access the underlying ArrayBuffer.
- Updated
IVideoCharacter.videoDatatype to allow null values - Modified video blob creation to use
videoData.bufferas ArrayBuffer
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/media/src/interface/IVideoCharacter.ts | Updated videoData property to allow null values |
| packages/media/src/Video/usecase/VideoBuildFromCharacterUseCase.ts | Modified blob creation to use videoData.buffer with ArrayBuffer casting |
| @@ -25,7 +25,7 @@ export const execute = (video: Video, character: IVideoCharacter): void => | |||
| video.volume = character.volume; | |||
|
|
|||
There was a problem hiding this comment.
Potential null pointer exception when accessing character.videoData.buffer. Since videoData can now be null (as per the interface update), this will throw an error if character.videoData is null. Add a null check before accessing the buffer property.
| if (!character.videoData) return; |
|
|
||
| video.src = URL.createObjectURL(new Blob( | ||
| [character.videoData], | ||
| [character.videoData.buffer as ArrayBuffer], |
There was a problem hiding this comment.
The type casting as ArrayBuffer suggests uncertainty about the actual type. Consider using proper type guards or validation to ensure the buffer property exists and is of the expected type before casting.
| [character.videoData.buffer as ArrayBuffer], | |
| [ArrayBuffer.isView(character.videoData) ? character.videoData.buffer : new ArrayBuffer(0)], |
No description provided.