* Creates VideoReader instances for all videos in the PAG file. * For each video ID, retrieves MP4 data and initializes the corresponding VideoReader. * Also prepares the first frame with the initial playback rate.
()
| 68 | * Also prepares the first frame with the initial playback rate. |
| 69 | */ |
| 70 | public async createVideoReader() { |
| 71 | for (const id of this.videoIDs) { |
| 72 | // Retrieve MP4 data for the current video ID |
| 73 | const mp4Data = this.wasmIns._getMp4DataByID(id); |
| 74 | if (mp4Data !== null) { |
| 75 | // Create VideoReader with video metadata (width, height, frame rate, static time ranges) |
| 76 | this.videoReaderMap.set(id, await PAGModule.VideoReader.create(mp4Data, this.wasmIns._getWidthByID(id), this.wasmIns._getHeightByID(id), |
| 77 | this.wasmIns._getFrameRateByID(id), this.wasmIns._getStaticTimeRangesByID(id))); |
| 78 | // Prepare the first frame (frame 0) with the current playback rate |
| 79 | await this.videoReaderMap.get(id)?.prepare(0, this.wasmIns._getPlaybackRateByID(id)); |
| 80 | } |
| 81 | |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Retrieves a VideoReader instance by video ID. |