We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9e03e46 commit 0df93e0Copy full SHA for 0df93e0
2 files changed
.changeset/wild-ideas-grin.md
@@ -0,0 +1,5 @@
1
+---
2
+'js-vtt': patch
3
4
+
5
+Add getCues method to return all cues
src/vtt.ts
@@ -231,6 +231,14 @@ export class VTT {
231
232
return true;
233
}
234
+ /**
235
+ * Retrieves all cue segments from the VTT instance, filtering the internal list of segments to return only those that are instances of the Cue class.
236
+ *
237
+ * @returns An array of Cue instances representing all cue segments in the VTT file.
238
+ */
239
+ getCues() {
240
+ return this.#segments.filter((s): s is Cue => s instanceof Cue);
241
+ }
242
/**
243
* Converts the VTT instance to a JSON representation, including the header and all segments.
244
* This can be useful for serialization, debugging, or interoperability with other systems.
0 commit comments