MCPcopy Create free account
hub / github.com/Tencent/libpag / createVideoReader

Method createVideoReader

web/src/video-reader-manager.ts:70–83  ·  view source on GitHub ↗

* 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.

()

Source from the content-addressed store, hash-verified

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.

Callers 1

makeMethod · 0.95

Calls 4

setMethod · 0.45
createMethod · 0.45
prepareMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected