11//@ts -ignore
22import E2EEWorker from '../../src/e2ee/worker/e2ee.worker?worker' ;
3+ //@ts -ignore
4+ import FrameMetadataWorker from '../../src/frameMetadata/worker/frameMetadata.worker?worker' ;
35import type {
46 ChatMessage ,
57 LocalDataTrack ,
@@ -44,8 +46,6 @@ import {
4446 supportsAV1 ,
4547 supportsVP9 ,
4648} from '../../src/index' ;
47- //@ts -ignore
48- import PTWorker from '../../src/packetTrailer/worker/packetTrailer.worker?worker' ;
4949import type { DataTrackFrame } from '../../src/room/data-track/frame' ;
5050import { TrackEvent } from '../../src/room/events' ;
5151import { isSVCCodec , sleep , supportsH265 } from '../../src/room/utils' ;
@@ -102,38 +102,38 @@ function updateSearchParams(url: string, token: string, key: string) {
102102 window . history . replaceState ( null , '' , `${ window . location . pathname } ?${ params . toString ( ) } ` ) ;
103103}
104104
105- function getPacketTrailerPublishOptions ( ) {
106- const enabled = ( < HTMLInputElement > $ ( 'packet-trailer ' ) ) . checked ;
107- const timestamp = enabled && ( < HTMLInputElement > $ ( 'packet-trailer -timestamp' ) ) . checked ;
108- const frameId = enabled && ( < HTMLInputElement > $ ( 'packet-trailer -frame-id' ) ) . checked ;
105+ function getFrameMetadataPublishOptions ( ) {
106+ const enabled = ( < HTMLInputElement > $ ( 'frame-metadata ' ) ) . checked ;
107+ const timestamp = enabled && ( < HTMLInputElement > $ ( 'frame-metadata -timestamp' ) ) . checked ;
108+ const frameId = enabled && ( < HTMLInputElement > $ ( 'frame-metadata -frame-id' ) ) . checked ;
109109
110110 return timestamp || frameId ? { timestamp, frameId } : undefined ;
111111}
112112
113- function syncPacketTrailerPublishOptions ( room = currentRoom ) {
114- const packetTrailer = getPacketTrailerPublishOptions ( ) ;
113+ function syncFrameMetadataPublishOptions ( room = currentRoom ) {
114+ const frameMetadata = getFrameMetadataPublishOptions ( ) ;
115115 if ( ! room ) {
116- return packetTrailer ;
116+ return frameMetadata ;
117117 }
118118
119- room . options . publishDefaults . packetTrailer = packetTrailer ;
119+ room . options . publishDefaults . frameMetadata = frameMetadata ;
120120 room . localParticipant . trackPublications . forEach ( ( pub ) => {
121121 if ( pub . kind !== Track . Kind . Video ) {
122122 return ;
123123 }
124- pub . options = { ...pub . options , packetTrailer } ;
124+ pub . options = { ...pub . options , frameMetadata } ;
125125 if ( pub . track && isVideoTrack ( pub . track ) ) {
126- pub . track . publishOptions = { ...pub . track . publishOptions , packetTrailer } ;
126+ pub . track . publishOptions = { ...pub . track . publishOptions , frameMetadata } ;
127127 }
128128 } ) ;
129- return packetTrailer ;
129+ return frameMetadata ;
130130}
131131
132- function syncPacketTrailerFeatureControls ( ) {
133- const enabled = ( < HTMLInputElement > $ ( 'packet-trailer ' ) ) . checked ;
134- const featureControls = $ ( 'packet-trailer -features' ) ;
135- const timestamp = < HTMLInputElement > $ ( 'packet-trailer -timestamp' ) ;
136- const frameId = < HTMLInputElement > $ ( 'packet-trailer -frame-id' ) ;
132+ function syncFrameMetadataFeatureControls ( ) {
133+ const enabled = ( < HTMLInputElement > $ ( 'frame-metadata ' ) ) . checked ;
134+ const featureControls = $ ( 'frame-metadata -features' ) ;
135+ const timestamp = < HTMLInputElement > $ ( 'frame-metadata -timestamp' ) ;
136+ const frameId = < HTMLInputElement > $ ( 'frame-metadata -frame-id' ) ;
137137
138138 featureControls . style . display = enabled ? 'block' : 'none' ;
139139 timestamp . disabled = ! enabled ;
@@ -142,20 +142,20 @@ function syncPacketTrailerFeatureControls() {
142142 timestamp . checked = false ;
143143 frameId . checked = false ;
144144 }
145- syncPacketTrailerPublishOptions ( ) ;
145+ syncFrameMetadataPublishOptions ( ) ;
146146}
147147
148- ( < HTMLInputElement > $ ( 'packet-trailer ' ) ) . addEventListener (
148+ ( < HTMLInputElement > $ ( 'frame-metadata ' ) ) . addEventListener (
149149 'change' ,
150- syncPacketTrailerFeatureControls ,
150+ syncFrameMetadataFeatureControls ,
151151) ;
152- ( < HTMLInputElement > $ ( 'packet-trailer -timestamp' ) ) . addEventListener ( 'change' , ( ) =>
153- syncPacketTrailerPublishOptions ( ) ,
152+ ( < HTMLInputElement > $ ( 'frame-metadata -timestamp' ) ) . addEventListener ( 'change' , ( ) =>
153+ syncFrameMetadataPublishOptions ( ) ,
154154) ;
155- ( < HTMLInputElement > $ ( 'packet-trailer -frame-id' ) ) . addEventListener ( 'change' , ( ) =>
156- syncPacketTrailerPublishOptions ( ) ,
155+ ( < HTMLInputElement > $ ( 'frame-metadata -frame-id' ) ) . addEventListener ( 'change' , ( ) =>
156+ syncFrameMetadataPublishOptions ( ) ,
157157) ;
158- syncPacketTrailerFeatureControls ( ) ;
158+ syncFrameMetadataFeatureControls ( ) ;
159159
160160// handles actions from the HTML
161161const appActions = {
@@ -181,8 +181,8 @@ const appActions = {
181181 const cryptoKey = ( < HTMLSelectElement > $ ( 'crypto-key' ) ) . value ;
182182 const autoSubscribe = ( < HTMLInputElement > $ ( 'auto-subscribe' ) ) . checked ;
183183 const e2eeEnabled = ( < HTMLInputElement > $ ( 'e2ee' ) ) . checked ;
184- const packetTrailerEnabled = ( < HTMLInputElement > $ ( 'packet-trailer ' ) ) . checked ;
185- const packetTrailer = getPacketTrailerPublishOptions ( ) ;
184+ const frameMetadataEnabled = ( < HTMLInputElement > $ ( 'frame-metadata ' ) ) . checked ;
185+ const frameMetadata = getFrameMetadataPublishOptions ( ) ;
186186 const audioOutputId = ( < HTMLSelectElement > $ ( 'audio-output' ) ) . value ;
187187 let backupCodecPolicy : BackupCodecPolicy | undefined ;
188188 if ( ( < HTMLInputElement > $ ( 'multicodec-simulcast' ) ) . checked ) {
@@ -207,15 +207,15 @@ const appActions = {
207207 screenShareEncoding : ScreenSharePresets . h1080fps30 . encoding ,
208208 scalabilityMode : 'L3T3_KEY' ,
209209 backupCodecPolicy : backupCodecPolicy ,
210- packetTrailer ,
210+ frameMetadata ,
211211 } ,
212212 videoCaptureDefaults : {
213213 resolution : VideoPresets . h720 . resolution ,
214214 } ,
215215 encryption : e2eeEnabled
216216 ? { keyProvider : state . e2eeKeyProvider , worker : new E2EEWorker ( ) }
217217 : undefined ,
218- packetTrailer : packetTrailerEnabled ? { worker : new PTWorker ( ) } : undefined ,
218+ frameMetadata : frameMetadataEnabled ? { worker : new FrameMetadataWorker ( ) } : undefined ,
219219 } ;
220220 if (
221221 roomOpts . publishDefaults ?. videoCodec === 'av1' ||
@@ -571,7 +571,7 @@ const appActions = {
571571 // read and set current key from input
572572 const cryptoKey = ( < HTMLSelectElement > $ ( 'crypto-key' ) ) . value ;
573573 state . e2eeKeyProvider . setKey ( cryptoKey ) ;
574- syncPacketTrailerPublishOptions ( currentRoom ) ;
574+ syncFrameMetadataPublishOptions ( currentRoom ) ;
575575
576576 await currentRoom . setE2EEEnabled ( ! currentRoom . isE2EEEnabled ) ;
577577 } ,
@@ -649,9 +649,9 @@ const appActions = {
649649 } else {
650650 appendLog ( 'enabling video' ) ;
651651 }
652- const publishOptions = syncPacketTrailerPublishOptions ( currentRoom ) ;
652+ const publishOptions = syncFrameMetadataPublishOptions ( currentRoom ) ;
653653 await currentRoom . localParticipant . setCameraEnabled ( ! enabled , undefined , {
654- packetTrailer : publishOptions ,
654+ frameMetadata : publishOptions ,
655655 } ) ;
656656 setButtonDisabled ( 'toggle-video-button' , false ) ;
657657 renderParticipant ( currentRoom . localParticipant ) ;
0 commit comments