github.com/primecitizens/pcz/std@v0.2.1/plat/js/web/apis09_js_wasm.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 package web 5 6 import ( 7 "github.com/primecitizens/pcz/std/core/abi" 8 "github.com/primecitizens/pcz/std/core/mark" 9 "github.com/primecitizens/pcz/std/ffi/js" 10 "github.com/primecitizens/pcz/std/plat/js/web/bindings" 11 ) 12 13 type MediaStreamTrack struct { 14 EventTarget 15 } 16 17 func (this MediaStreamTrack) Once() MediaStreamTrack { 18 this.ref.Once() 19 return this 20 } 21 22 func (this MediaStreamTrack) Ref() js.Ref { 23 return this.EventTarget.Ref() 24 } 25 26 func (this MediaStreamTrack) FromRef(ref js.Ref) MediaStreamTrack { 27 this.EventTarget = this.EventTarget.FromRef(ref) 28 return this 29 } 30 31 func (this MediaStreamTrack) Free() { 32 this.ref.Free() 33 } 34 35 // Kind returns the value of property "MediaStreamTrack.kind". 36 // 37 // It returns ok=false if there is no such property. 38 func (this MediaStreamTrack) Kind() (ret js.String, ok bool) { 39 ok = js.True == bindings.GetMediaStreamTrackKind( 40 this.ref, js.Pointer(&ret), 41 ) 42 return 43 } 44 45 // Id returns the value of property "MediaStreamTrack.id". 46 // 47 // It returns ok=false if there is no such property. 48 func (this MediaStreamTrack) Id() (ret js.String, ok bool) { 49 ok = js.True == bindings.GetMediaStreamTrackId( 50 this.ref, js.Pointer(&ret), 51 ) 52 return 53 } 54 55 // Label returns the value of property "MediaStreamTrack.label". 56 // 57 // It returns ok=false if there is no such property. 58 func (this MediaStreamTrack) Label() (ret js.String, ok bool) { 59 ok = js.True == bindings.GetMediaStreamTrackLabel( 60 this.ref, js.Pointer(&ret), 61 ) 62 return 63 } 64 65 // Enabled returns the value of property "MediaStreamTrack.enabled". 66 // 67 // It returns ok=false if there is no such property. 68 func (this MediaStreamTrack) Enabled() (ret bool, ok bool) { 69 ok = js.True == bindings.GetMediaStreamTrackEnabled( 70 this.ref, js.Pointer(&ret), 71 ) 72 return 73 } 74 75 // SetEnabled sets the value of property "MediaStreamTrack.enabled" to val. 76 // 77 // It returns false if the property cannot be set. 78 func (this MediaStreamTrack) SetEnabled(val bool) bool { 79 return js.True == bindings.SetMediaStreamTrackEnabled( 80 this.ref, 81 js.Bool(bool(val)), 82 ) 83 } 84 85 // Muted returns the value of property "MediaStreamTrack.muted". 86 // 87 // It returns ok=false if there is no such property. 88 func (this MediaStreamTrack) Muted() (ret bool, ok bool) { 89 ok = js.True == bindings.GetMediaStreamTrackMuted( 90 this.ref, js.Pointer(&ret), 91 ) 92 return 93 } 94 95 // ReadyState returns the value of property "MediaStreamTrack.readyState". 96 // 97 // It returns ok=false if there is no such property. 98 func (this MediaStreamTrack) ReadyState() (ret MediaStreamTrackState, ok bool) { 99 ok = js.True == bindings.GetMediaStreamTrackReadyState( 100 this.ref, js.Pointer(&ret), 101 ) 102 return 103 } 104 105 // ContentHint returns the value of property "MediaStreamTrack.contentHint". 106 // 107 // It returns ok=false if there is no such property. 108 func (this MediaStreamTrack) ContentHint() (ret js.String, ok bool) { 109 ok = js.True == bindings.GetMediaStreamTrackContentHint( 110 this.ref, js.Pointer(&ret), 111 ) 112 return 113 } 114 115 // SetContentHint sets the value of property "MediaStreamTrack.contentHint" to val. 116 // 117 // It returns false if the property cannot be set. 118 func (this MediaStreamTrack) SetContentHint(val js.String) bool { 119 return js.True == bindings.SetMediaStreamTrackContentHint( 120 this.ref, 121 val.Ref(), 122 ) 123 } 124 125 // Isolated returns the value of property "MediaStreamTrack.isolated". 126 // 127 // It returns ok=false if there is no such property. 128 func (this MediaStreamTrack) Isolated() (ret bool, ok bool) { 129 ok = js.True == bindings.GetMediaStreamTrackIsolated( 130 this.ref, js.Pointer(&ret), 131 ) 132 return 133 } 134 135 // HasFuncClone returns true if the method "MediaStreamTrack.clone" exists. 136 func (this MediaStreamTrack) HasFuncClone() bool { 137 return js.True == bindings.HasFuncMediaStreamTrackClone( 138 this.ref, 139 ) 140 } 141 142 // FuncClone returns the method "MediaStreamTrack.clone". 143 func (this MediaStreamTrack) FuncClone() (fn js.Func[func() MediaStreamTrack]) { 144 bindings.FuncMediaStreamTrackClone( 145 this.ref, js.Pointer(&fn), 146 ) 147 return 148 } 149 150 // Clone calls the method "MediaStreamTrack.clone". 151 func (this MediaStreamTrack) Clone() (ret MediaStreamTrack) { 152 bindings.CallMediaStreamTrackClone( 153 this.ref, js.Pointer(&ret), 154 ) 155 156 return 157 } 158 159 // TryClone calls the method "MediaStreamTrack.clone" 160 // in a try/catch block and returns (_, err, ok = false) when it went through 161 // the catch clause. 162 func (this MediaStreamTrack) TryClone() (ret MediaStreamTrack, exception js.Any, ok bool) { 163 ok = js.True == bindings.TryMediaStreamTrackClone( 164 this.ref, js.Pointer(&ret), js.Pointer(&exception), 165 ) 166 167 return 168 } 169 170 // HasFuncStop returns true if the method "MediaStreamTrack.stop" exists. 171 func (this MediaStreamTrack) HasFuncStop() bool { 172 return js.True == bindings.HasFuncMediaStreamTrackStop( 173 this.ref, 174 ) 175 } 176 177 // FuncStop returns the method "MediaStreamTrack.stop". 178 func (this MediaStreamTrack) FuncStop() (fn js.Func[func()]) { 179 bindings.FuncMediaStreamTrackStop( 180 this.ref, js.Pointer(&fn), 181 ) 182 return 183 } 184 185 // Stop calls the method "MediaStreamTrack.stop". 186 func (this MediaStreamTrack) Stop() (ret js.Void) { 187 bindings.CallMediaStreamTrackStop( 188 this.ref, js.Pointer(&ret), 189 ) 190 191 return 192 } 193 194 // TryStop calls the method "MediaStreamTrack.stop" 195 // in a try/catch block and returns (_, err, ok = false) when it went through 196 // the catch clause. 197 func (this MediaStreamTrack) TryStop() (ret js.Void, exception js.Any, ok bool) { 198 ok = js.True == bindings.TryMediaStreamTrackStop( 199 this.ref, js.Pointer(&ret), js.Pointer(&exception), 200 ) 201 202 return 203 } 204 205 // HasFuncGetCapabilities returns true if the method "MediaStreamTrack.getCapabilities" exists. 206 func (this MediaStreamTrack) HasFuncGetCapabilities() bool { 207 return js.True == bindings.HasFuncMediaStreamTrackGetCapabilities( 208 this.ref, 209 ) 210 } 211 212 // FuncGetCapabilities returns the method "MediaStreamTrack.getCapabilities". 213 func (this MediaStreamTrack) FuncGetCapabilities() (fn js.Func[func() MediaTrackCapabilities]) { 214 bindings.FuncMediaStreamTrackGetCapabilities( 215 this.ref, js.Pointer(&fn), 216 ) 217 return 218 } 219 220 // GetCapabilities calls the method "MediaStreamTrack.getCapabilities". 221 func (this MediaStreamTrack) GetCapabilities() (ret MediaTrackCapabilities) { 222 bindings.CallMediaStreamTrackGetCapabilities( 223 this.ref, js.Pointer(&ret), 224 ) 225 226 return 227 } 228 229 // TryGetCapabilities calls the method "MediaStreamTrack.getCapabilities" 230 // in a try/catch block and returns (_, err, ok = false) when it went through 231 // the catch clause. 232 func (this MediaStreamTrack) TryGetCapabilities() (ret MediaTrackCapabilities, exception js.Any, ok bool) { 233 ok = js.True == bindings.TryMediaStreamTrackGetCapabilities( 234 this.ref, js.Pointer(&ret), js.Pointer(&exception), 235 ) 236 237 return 238 } 239 240 // HasFuncGetConstraints returns true if the method "MediaStreamTrack.getConstraints" exists. 241 func (this MediaStreamTrack) HasFuncGetConstraints() bool { 242 return js.True == bindings.HasFuncMediaStreamTrackGetConstraints( 243 this.ref, 244 ) 245 } 246 247 // FuncGetConstraints returns the method "MediaStreamTrack.getConstraints". 248 func (this MediaStreamTrack) FuncGetConstraints() (fn js.Func[func() MediaTrackConstraints]) { 249 bindings.FuncMediaStreamTrackGetConstraints( 250 this.ref, js.Pointer(&fn), 251 ) 252 return 253 } 254 255 // GetConstraints calls the method "MediaStreamTrack.getConstraints". 256 func (this MediaStreamTrack) GetConstraints() (ret MediaTrackConstraints) { 257 bindings.CallMediaStreamTrackGetConstraints( 258 this.ref, js.Pointer(&ret), 259 ) 260 261 return 262 } 263 264 // TryGetConstraints calls the method "MediaStreamTrack.getConstraints" 265 // in a try/catch block and returns (_, err, ok = false) when it went through 266 // the catch clause. 267 func (this MediaStreamTrack) TryGetConstraints() (ret MediaTrackConstraints, exception js.Any, ok bool) { 268 ok = js.True == bindings.TryMediaStreamTrackGetConstraints( 269 this.ref, js.Pointer(&ret), js.Pointer(&exception), 270 ) 271 272 return 273 } 274 275 // HasFuncGetSettings returns true if the method "MediaStreamTrack.getSettings" exists. 276 func (this MediaStreamTrack) HasFuncGetSettings() bool { 277 return js.True == bindings.HasFuncMediaStreamTrackGetSettings( 278 this.ref, 279 ) 280 } 281 282 // FuncGetSettings returns the method "MediaStreamTrack.getSettings". 283 func (this MediaStreamTrack) FuncGetSettings() (fn js.Func[func() MediaTrackSettings]) { 284 bindings.FuncMediaStreamTrackGetSettings( 285 this.ref, js.Pointer(&fn), 286 ) 287 return 288 } 289 290 // GetSettings calls the method "MediaStreamTrack.getSettings". 291 func (this MediaStreamTrack) GetSettings() (ret MediaTrackSettings) { 292 bindings.CallMediaStreamTrackGetSettings( 293 this.ref, js.Pointer(&ret), 294 ) 295 296 return 297 } 298 299 // TryGetSettings calls the method "MediaStreamTrack.getSettings" 300 // in a try/catch block and returns (_, err, ok = false) when it went through 301 // the catch clause. 302 func (this MediaStreamTrack) TryGetSettings() (ret MediaTrackSettings, exception js.Any, ok bool) { 303 ok = js.True == bindings.TryMediaStreamTrackGetSettings( 304 this.ref, js.Pointer(&ret), js.Pointer(&exception), 305 ) 306 307 return 308 } 309 310 // HasFuncApplyConstraints returns true if the method "MediaStreamTrack.applyConstraints" exists. 311 func (this MediaStreamTrack) HasFuncApplyConstraints() bool { 312 return js.True == bindings.HasFuncMediaStreamTrackApplyConstraints( 313 this.ref, 314 ) 315 } 316 317 // FuncApplyConstraints returns the method "MediaStreamTrack.applyConstraints". 318 func (this MediaStreamTrack) FuncApplyConstraints() (fn js.Func[func(constraints MediaTrackConstraints) js.Promise[js.Void]]) { 319 bindings.FuncMediaStreamTrackApplyConstraints( 320 this.ref, js.Pointer(&fn), 321 ) 322 return 323 } 324 325 // ApplyConstraints calls the method "MediaStreamTrack.applyConstraints". 326 func (this MediaStreamTrack) ApplyConstraints(constraints MediaTrackConstraints) (ret js.Promise[js.Void]) { 327 bindings.CallMediaStreamTrackApplyConstraints( 328 this.ref, js.Pointer(&ret), 329 js.Pointer(&constraints), 330 ) 331 332 return 333 } 334 335 // TryApplyConstraints calls the method "MediaStreamTrack.applyConstraints" 336 // in a try/catch block and returns (_, err, ok = false) when it went through 337 // the catch clause. 338 func (this MediaStreamTrack) TryApplyConstraints(constraints MediaTrackConstraints) (ret js.Promise[js.Void], exception js.Any, ok bool) { 339 ok = js.True == bindings.TryMediaStreamTrackApplyConstraints( 340 this.ref, js.Pointer(&ret), js.Pointer(&exception), 341 js.Pointer(&constraints), 342 ) 343 344 return 345 } 346 347 // HasFuncApplyConstraints1 returns true if the method "MediaStreamTrack.applyConstraints" exists. 348 func (this MediaStreamTrack) HasFuncApplyConstraints1() bool { 349 return js.True == bindings.HasFuncMediaStreamTrackApplyConstraints1( 350 this.ref, 351 ) 352 } 353 354 // FuncApplyConstraints1 returns the method "MediaStreamTrack.applyConstraints". 355 func (this MediaStreamTrack) FuncApplyConstraints1() (fn js.Func[func() js.Promise[js.Void]]) { 356 bindings.FuncMediaStreamTrackApplyConstraints1( 357 this.ref, js.Pointer(&fn), 358 ) 359 return 360 } 361 362 // ApplyConstraints1 calls the method "MediaStreamTrack.applyConstraints". 363 func (this MediaStreamTrack) ApplyConstraints1() (ret js.Promise[js.Void]) { 364 bindings.CallMediaStreamTrackApplyConstraints1( 365 this.ref, js.Pointer(&ret), 366 ) 367 368 return 369 } 370 371 // TryApplyConstraints1 calls the method "MediaStreamTrack.applyConstraints" 372 // in a try/catch block and returns (_, err, ok = false) when it went through 373 // the catch clause. 374 func (this MediaStreamTrack) TryApplyConstraints1() (ret js.Promise[js.Void], exception js.Any, ok bool) { 375 ok = js.True == bindings.TryMediaStreamTrackApplyConstraints1( 376 this.ref, js.Pointer(&ret), js.Pointer(&exception), 377 ) 378 379 return 380 } 381 382 // HasFuncGetSupportedCaptureActions returns true if the method "MediaStreamTrack.getSupportedCaptureActions" exists. 383 func (this MediaStreamTrack) HasFuncGetSupportedCaptureActions() bool { 384 return js.True == bindings.HasFuncMediaStreamTrackGetSupportedCaptureActions( 385 this.ref, 386 ) 387 } 388 389 // FuncGetSupportedCaptureActions returns the method "MediaStreamTrack.getSupportedCaptureActions". 390 func (this MediaStreamTrack) FuncGetSupportedCaptureActions() (fn js.Func[func() js.Array[js.String]]) { 391 bindings.FuncMediaStreamTrackGetSupportedCaptureActions( 392 this.ref, js.Pointer(&fn), 393 ) 394 return 395 } 396 397 // GetSupportedCaptureActions calls the method "MediaStreamTrack.getSupportedCaptureActions". 398 func (this MediaStreamTrack) GetSupportedCaptureActions() (ret js.Array[js.String]) { 399 bindings.CallMediaStreamTrackGetSupportedCaptureActions( 400 this.ref, js.Pointer(&ret), 401 ) 402 403 return 404 } 405 406 // TryGetSupportedCaptureActions calls the method "MediaStreamTrack.getSupportedCaptureActions" 407 // in a try/catch block and returns (_, err, ok = false) when it went through 408 // the catch clause. 409 func (this MediaStreamTrack) TryGetSupportedCaptureActions() (ret js.Array[js.String], exception js.Any, ok bool) { 410 ok = js.True == bindings.TryMediaStreamTrackGetSupportedCaptureActions( 411 this.ref, js.Pointer(&ret), js.Pointer(&exception), 412 ) 413 414 return 415 } 416 417 // HasFuncSendCaptureAction returns true if the method "MediaStreamTrack.sendCaptureAction" exists. 418 func (this MediaStreamTrack) HasFuncSendCaptureAction() bool { 419 return js.True == bindings.HasFuncMediaStreamTrackSendCaptureAction( 420 this.ref, 421 ) 422 } 423 424 // FuncSendCaptureAction returns the method "MediaStreamTrack.sendCaptureAction". 425 func (this MediaStreamTrack) FuncSendCaptureAction() (fn js.Func[func(action CaptureAction) js.Promise[js.Void]]) { 426 bindings.FuncMediaStreamTrackSendCaptureAction( 427 this.ref, js.Pointer(&fn), 428 ) 429 return 430 } 431 432 // SendCaptureAction calls the method "MediaStreamTrack.sendCaptureAction". 433 func (this MediaStreamTrack) SendCaptureAction(action CaptureAction) (ret js.Promise[js.Void]) { 434 bindings.CallMediaStreamTrackSendCaptureAction( 435 this.ref, js.Pointer(&ret), 436 uint32(action), 437 ) 438 439 return 440 } 441 442 // TrySendCaptureAction calls the method "MediaStreamTrack.sendCaptureAction" 443 // in a try/catch block and returns (_, err, ok = false) when it went through 444 // the catch clause. 445 func (this MediaStreamTrack) TrySendCaptureAction(action CaptureAction) (ret js.Promise[js.Void], exception js.Any, ok bool) { 446 ok = js.True == bindings.TryMediaStreamTrackSendCaptureAction( 447 this.ref, js.Pointer(&ret), js.Pointer(&exception), 448 uint32(action), 449 ) 450 451 return 452 } 453 454 // HasFuncGetCaptureHandle returns true if the method "MediaStreamTrack.getCaptureHandle" exists. 455 func (this MediaStreamTrack) HasFuncGetCaptureHandle() bool { 456 return js.True == bindings.HasFuncMediaStreamTrackGetCaptureHandle( 457 this.ref, 458 ) 459 } 460 461 // FuncGetCaptureHandle returns the method "MediaStreamTrack.getCaptureHandle". 462 func (this MediaStreamTrack) FuncGetCaptureHandle() (fn js.Func[func() CaptureHandle]) { 463 bindings.FuncMediaStreamTrackGetCaptureHandle( 464 this.ref, js.Pointer(&fn), 465 ) 466 return 467 } 468 469 // GetCaptureHandle calls the method "MediaStreamTrack.getCaptureHandle". 470 func (this MediaStreamTrack) GetCaptureHandle() (ret CaptureHandle) { 471 bindings.CallMediaStreamTrackGetCaptureHandle( 472 this.ref, js.Pointer(&ret), 473 ) 474 475 return 476 } 477 478 // TryGetCaptureHandle calls the method "MediaStreamTrack.getCaptureHandle" 479 // in a try/catch block and returns (_, err, ok = false) when it went through 480 // the catch clause. 481 func (this MediaStreamTrack) TryGetCaptureHandle() (ret CaptureHandle, exception js.Any, ok bool) { 482 ok = js.True == bindings.TryMediaStreamTrackGetCaptureHandle( 483 this.ref, js.Pointer(&ret), js.Pointer(&exception), 484 ) 485 486 return 487 } 488 489 func NewMediaStream(stream MediaStream) (ret MediaStream) { 490 ret.ref = bindings.NewMediaStreamByMediaStream( 491 stream.Ref()) 492 return 493 } 494 495 func NewMediaStreamByMediaStream1(tracks js.Array[MediaStreamTrack]) (ret MediaStream) { 496 ret.ref = bindings.NewMediaStreamByMediaStream1( 497 tracks.Ref()) 498 return 499 } 500 501 type MediaStream struct { 502 EventTarget 503 } 504 505 func (this MediaStream) Once() MediaStream { 506 this.ref.Once() 507 return this 508 } 509 510 func (this MediaStream) Ref() js.Ref { 511 return this.EventTarget.Ref() 512 } 513 514 func (this MediaStream) FromRef(ref js.Ref) MediaStream { 515 this.EventTarget = this.EventTarget.FromRef(ref) 516 return this 517 } 518 519 func (this MediaStream) Free() { 520 this.ref.Free() 521 } 522 523 // Id returns the value of property "MediaStream.id". 524 // 525 // It returns ok=false if there is no such property. 526 func (this MediaStream) Id() (ret js.String, ok bool) { 527 ok = js.True == bindings.GetMediaStreamId( 528 this.ref, js.Pointer(&ret), 529 ) 530 return 531 } 532 533 // Active returns the value of property "MediaStream.active". 534 // 535 // It returns ok=false if there is no such property. 536 func (this MediaStream) Active() (ret bool, ok bool) { 537 ok = js.True == bindings.GetMediaStreamActive( 538 this.ref, js.Pointer(&ret), 539 ) 540 return 541 } 542 543 // HasFuncGetAudioTracks returns true if the method "MediaStream.getAudioTracks" exists. 544 func (this MediaStream) HasFuncGetAudioTracks() bool { 545 return js.True == bindings.HasFuncMediaStreamGetAudioTracks( 546 this.ref, 547 ) 548 } 549 550 // FuncGetAudioTracks returns the method "MediaStream.getAudioTracks". 551 func (this MediaStream) FuncGetAudioTracks() (fn js.Func[func() js.Array[MediaStreamTrack]]) { 552 bindings.FuncMediaStreamGetAudioTracks( 553 this.ref, js.Pointer(&fn), 554 ) 555 return 556 } 557 558 // GetAudioTracks calls the method "MediaStream.getAudioTracks". 559 func (this MediaStream) GetAudioTracks() (ret js.Array[MediaStreamTrack]) { 560 bindings.CallMediaStreamGetAudioTracks( 561 this.ref, js.Pointer(&ret), 562 ) 563 564 return 565 } 566 567 // TryGetAudioTracks calls the method "MediaStream.getAudioTracks" 568 // in a try/catch block and returns (_, err, ok = false) when it went through 569 // the catch clause. 570 func (this MediaStream) TryGetAudioTracks() (ret js.Array[MediaStreamTrack], exception js.Any, ok bool) { 571 ok = js.True == bindings.TryMediaStreamGetAudioTracks( 572 this.ref, js.Pointer(&ret), js.Pointer(&exception), 573 ) 574 575 return 576 } 577 578 // HasFuncGetVideoTracks returns true if the method "MediaStream.getVideoTracks" exists. 579 func (this MediaStream) HasFuncGetVideoTracks() bool { 580 return js.True == bindings.HasFuncMediaStreamGetVideoTracks( 581 this.ref, 582 ) 583 } 584 585 // FuncGetVideoTracks returns the method "MediaStream.getVideoTracks". 586 func (this MediaStream) FuncGetVideoTracks() (fn js.Func[func() js.Array[MediaStreamTrack]]) { 587 bindings.FuncMediaStreamGetVideoTracks( 588 this.ref, js.Pointer(&fn), 589 ) 590 return 591 } 592 593 // GetVideoTracks calls the method "MediaStream.getVideoTracks". 594 func (this MediaStream) GetVideoTracks() (ret js.Array[MediaStreamTrack]) { 595 bindings.CallMediaStreamGetVideoTracks( 596 this.ref, js.Pointer(&ret), 597 ) 598 599 return 600 } 601 602 // TryGetVideoTracks calls the method "MediaStream.getVideoTracks" 603 // in a try/catch block and returns (_, err, ok = false) when it went through 604 // the catch clause. 605 func (this MediaStream) TryGetVideoTracks() (ret js.Array[MediaStreamTrack], exception js.Any, ok bool) { 606 ok = js.True == bindings.TryMediaStreamGetVideoTracks( 607 this.ref, js.Pointer(&ret), js.Pointer(&exception), 608 ) 609 610 return 611 } 612 613 // HasFuncGetTracks returns true if the method "MediaStream.getTracks" exists. 614 func (this MediaStream) HasFuncGetTracks() bool { 615 return js.True == bindings.HasFuncMediaStreamGetTracks( 616 this.ref, 617 ) 618 } 619 620 // FuncGetTracks returns the method "MediaStream.getTracks". 621 func (this MediaStream) FuncGetTracks() (fn js.Func[func() js.Array[MediaStreamTrack]]) { 622 bindings.FuncMediaStreamGetTracks( 623 this.ref, js.Pointer(&fn), 624 ) 625 return 626 } 627 628 // GetTracks calls the method "MediaStream.getTracks". 629 func (this MediaStream) GetTracks() (ret js.Array[MediaStreamTrack]) { 630 bindings.CallMediaStreamGetTracks( 631 this.ref, js.Pointer(&ret), 632 ) 633 634 return 635 } 636 637 // TryGetTracks calls the method "MediaStream.getTracks" 638 // in a try/catch block and returns (_, err, ok = false) when it went through 639 // the catch clause. 640 func (this MediaStream) TryGetTracks() (ret js.Array[MediaStreamTrack], exception js.Any, ok bool) { 641 ok = js.True == bindings.TryMediaStreamGetTracks( 642 this.ref, js.Pointer(&ret), js.Pointer(&exception), 643 ) 644 645 return 646 } 647 648 // HasFuncGetTrackById returns true if the method "MediaStream.getTrackById" exists. 649 func (this MediaStream) HasFuncGetTrackById() bool { 650 return js.True == bindings.HasFuncMediaStreamGetTrackById( 651 this.ref, 652 ) 653 } 654 655 // FuncGetTrackById returns the method "MediaStream.getTrackById". 656 func (this MediaStream) FuncGetTrackById() (fn js.Func[func(trackId js.String) MediaStreamTrack]) { 657 bindings.FuncMediaStreamGetTrackById( 658 this.ref, js.Pointer(&fn), 659 ) 660 return 661 } 662 663 // GetTrackById calls the method "MediaStream.getTrackById". 664 func (this MediaStream) GetTrackById(trackId js.String) (ret MediaStreamTrack) { 665 bindings.CallMediaStreamGetTrackById( 666 this.ref, js.Pointer(&ret), 667 trackId.Ref(), 668 ) 669 670 return 671 } 672 673 // TryGetTrackById calls the method "MediaStream.getTrackById" 674 // in a try/catch block and returns (_, err, ok = false) when it went through 675 // the catch clause. 676 func (this MediaStream) TryGetTrackById(trackId js.String) (ret MediaStreamTrack, exception js.Any, ok bool) { 677 ok = js.True == bindings.TryMediaStreamGetTrackById( 678 this.ref, js.Pointer(&ret), js.Pointer(&exception), 679 trackId.Ref(), 680 ) 681 682 return 683 } 684 685 // HasFuncAddTrack returns true if the method "MediaStream.addTrack" exists. 686 func (this MediaStream) HasFuncAddTrack() bool { 687 return js.True == bindings.HasFuncMediaStreamAddTrack( 688 this.ref, 689 ) 690 } 691 692 // FuncAddTrack returns the method "MediaStream.addTrack". 693 func (this MediaStream) FuncAddTrack() (fn js.Func[func(track MediaStreamTrack)]) { 694 bindings.FuncMediaStreamAddTrack( 695 this.ref, js.Pointer(&fn), 696 ) 697 return 698 } 699 700 // AddTrack calls the method "MediaStream.addTrack". 701 func (this MediaStream) AddTrack(track MediaStreamTrack) (ret js.Void) { 702 bindings.CallMediaStreamAddTrack( 703 this.ref, js.Pointer(&ret), 704 track.Ref(), 705 ) 706 707 return 708 } 709 710 // TryAddTrack calls the method "MediaStream.addTrack" 711 // in a try/catch block and returns (_, err, ok = false) when it went through 712 // the catch clause. 713 func (this MediaStream) TryAddTrack(track MediaStreamTrack) (ret js.Void, exception js.Any, ok bool) { 714 ok = js.True == bindings.TryMediaStreamAddTrack( 715 this.ref, js.Pointer(&ret), js.Pointer(&exception), 716 track.Ref(), 717 ) 718 719 return 720 } 721 722 // HasFuncRemoveTrack returns true if the method "MediaStream.removeTrack" exists. 723 func (this MediaStream) HasFuncRemoveTrack() bool { 724 return js.True == bindings.HasFuncMediaStreamRemoveTrack( 725 this.ref, 726 ) 727 } 728 729 // FuncRemoveTrack returns the method "MediaStream.removeTrack". 730 func (this MediaStream) FuncRemoveTrack() (fn js.Func[func(track MediaStreamTrack)]) { 731 bindings.FuncMediaStreamRemoveTrack( 732 this.ref, js.Pointer(&fn), 733 ) 734 return 735 } 736 737 // RemoveTrack calls the method "MediaStream.removeTrack". 738 func (this MediaStream) RemoveTrack(track MediaStreamTrack) (ret js.Void) { 739 bindings.CallMediaStreamRemoveTrack( 740 this.ref, js.Pointer(&ret), 741 track.Ref(), 742 ) 743 744 return 745 } 746 747 // TryRemoveTrack calls the method "MediaStream.removeTrack" 748 // in a try/catch block and returns (_, err, ok = false) when it went through 749 // the catch clause. 750 func (this MediaStream) TryRemoveTrack(track MediaStreamTrack) (ret js.Void, exception js.Any, ok bool) { 751 ok = js.True == bindings.TryMediaStreamRemoveTrack( 752 this.ref, js.Pointer(&ret), js.Pointer(&exception), 753 track.Ref(), 754 ) 755 756 return 757 } 758 759 // HasFuncClone returns true if the method "MediaStream.clone" exists. 760 func (this MediaStream) HasFuncClone() bool { 761 return js.True == bindings.HasFuncMediaStreamClone( 762 this.ref, 763 ) 764 } 765 766 // FuncClone returns the method "MediaStream.clone". 767 func (this MediaStream) FuncClone() (fn js.Func[func() MediaStream]) { 768 bindings.FuncMediaStreamClone( 769 this.ref, js.Pointer(&fn), 770 ) 771 return 772 } 773 774 // Clone calls the method "MediaStream.clone". 775 func (this MediaStream) Clone() (ret MediaStream) { 776 bindings.CallMediaStreamClone( 777 this.ref, js.Pointer(&ret), 778 ) 779 780 return 781 } 782 783 // TryClone calls the method "MediaStream.clone" 784 // in a try/catch block and returns (_, err, ok = false) when it went through 785 // the catch clause. 786 func (this MediaStream) TryClone() (ret MediaStream, exception js.Any, ok bool) { 787 ok = js.True == bindings.TryMediaStreamClone( 788 this.ref, js.Pointer(&ret), js.Pointer(&exception), 789 ) 790 791 return 792 } 793 794 const ( 795 MediaError_MEDIA_ERR_ABORTED uint16 = 1 796 MediaError_MEDIA_ERR_NETWORK uint16 = 2 797 MediaError_MEDIA_ERR_DECODE uint16 = 3 798 MediaError_MEDIA_ERR_SRC_NOT_SUPPORTED uint16 = 4 799 ) 800 801 type MediaError struct { 802 ref js.Ref 803 } 804 805 func (this MediaError) Once() MediaError { 806 this.ref.Once() 807 return this 808 } 809 810 func (this MediaError) Ref() js.Ref { 811 return this.ref 812 } 813 814 func (this MediaError) FromRef(ref js.Ref) MediaError { 815 this.ref = ref 816 return this 817 } 818 819 func (this MediaError) Free() { 820 this.ref.Free() 821 } 822 823 // Code returns the value of property "MediaError.code". 824 // 825 // It returns ok=false if there is no such property. 826 func (this MediaError) Code() (ret uint16, ok bool) { 827 ok = js.True == bindings.GetMediaErrorCode( 828 this.ref, js.Pointer(&ret), 829 ) 830 return 831 } 832 833 // Message returns the value of property "MediaError.message". 834 // 835 // It returns ok=false if there is no such property. 836 func (this MediaError) Message() (ret js.String, ok bool) { 837 ok = js.True == bindings.GetMediaErrorMessage( 838 this.ref, js.Pointer(&ret), 839 ) 840 return 841 } 842 843 type EndOfStreamError uint32 844 845 const ( 846 _ EndOfStreamError = iota 847 848 EndOfStreamError_NETWORK 849 EndOfStreamError_DECODE 850 ) 851 852 func (EndOfStreamError) FromRef(str js.Ref) EndOfStreamError { 853 return EndOfStreamError(bindings.ConstOfEndOfStreamError(str)) 854 } 855 856 func (x EndOfStreamError) String() (string, bool) { 857 switch x { 858 case EndOfStreamError_NETWORK: 859 return "network", true 860 case EndOfStreamError_DECODE: 861 return "decode", true 862 default: 863 return "", false 864 } 865 } 866 867 type MediaSourceHandle struct { 868 ref js.Ref 869 } 870 871 func (this MediaSourceHandle) Once() MediaSourceHandle { 872 this.ref.Once() 873 return this 874 } 875 876 func (this MediaSourceHandle) Ref() js.Ref { 877 return this.ref 878 } 879 880 func (this MediaSourceHandle) FromRef(ref js.Ref) MediaSourceHandle { 881 this.ref = ref 882 return this 883 } 884 885 func (this MediaSourceHandle) Free() { 886 this.ref.Free() 887 } 888 889 type SourceBufferList struct { 890 EventTarget 891 } 892 893 func (this SourceBufferList) Once() SourceBufferList { 894 this.ref.Once() 895 return this 896 } 897 898 func (this SourceBufferList) Ref() js.Ref { 899 return this.EventTarget.Ref() 900 } 901 902 func (this SourceBufferList) FromRef(ref js.Ref) SourceBufferList { 903 this.EventTarget = this.EventTarget.FromRef(ref) 904 return this 905 } 906 907 func (this SourceBufferList) Free() { 908 this.ref.Free() 909 } 910 911 // Length returns the value of property "SourceBufferList.length". 912 // 913 // It returns ok=false if there is no such property. 914 func (this SourceBufferList) Length() (ret uint32, ok bool) { 915 ok = js.True == bindings.GetSourceBufferListLength( 916 this.ref, js.Pointer(&ret), 917 ) 918 return 919 } 920 921 // HasFuncGet returns true if the method "SourceBufferList." exists. 922 func (this SourceBufferList) HasFuncGet() bool { 923 return js.True == bindings.HasFuncSourceBufferListGet( 924 this.ref, 925 ) 926 } 927 928 // FuncGet returns the method "SourceBufferList.". 929 func (this SourceBufferList) FuncGet() (fn js.Func[func(index uint32) SourceBuffer]) { 930 bindings.FuncSourceBufferListGet( 931 this.ref, js.Pointer(&fn), 932 ) 933 return 934 } 935 936 // Get calls the method "SourceBufferList.". 937 func (this SourceBufferList) Get(index uint32) (ret SourceBuffer) { 938 bindings.CallSourceBufferListGet( 939 this.ref, js.Pointer(&ret), 940 uint32(index), 941 ) 942 943 return 944 } 945 946 // TryGet calls the method "SourceBufferList." 947 // in a try/catch block and returns (_, err, ok = false) when it went through 948 // the catch clause. 949 func (this SourceBufferList) TryGet(index uint32) (ret SourceBuffer, exception js.Any, ok bool) { 950 ok = js.True == bindings.TrySourceBufferListGet( 951 this.ref, js.Pointer(&ret), js.Pointer(&exception), 952 uint32(index), 953 ) 954 955 return 956 } 957 958 type ReadyState uint32 959 960 const ( 961 _ ReadyState = iota 962 963 ReadyState_CLOSED 964 ReadyState_OPEN 965 ReadyState_ENDED 966 ) 967 968 func (ReadyState) FromRef(str js.Ref) ReadyState { 969 return ReadyState(bindings.ConstOfReadyState(str)) 970 } 971 972 func (x ReadyState) String() (string, bool) { 973 switch x { 974 case ReadyState_CLOSED: 975 return "closed", true 976 case ReadyState_OPEN: 977 return "open", true 978 case ReadyState_ENDED: 979 return "ended", true 980 default: 981 return "", false 982 } 983 } 984 985 type MediaSource struct { 986 EventTarget 987 } 988 989 func (this MediaSource) Once() MediaSource { 990 this.ref.Once() 991 return this 992 } 993 994 func (this MediaSource) Ref() js.Ref { 995 return this.EventTarget.Ref() 996 } 997 998 func (this MediaSource) FromRef(ref js.Ref) MediaSource { 999 this.EventTarget = this.EventTarget.FromRef(ref) 1000 return this 1001 } 1002 1003 func (this MediaSource) Free() { 1004 this.ref.Free() 1005 } 1006 1007 // Handle returns the value of property "MediaSource.handle". 1008 // 1009 // It returns ok=false if there is no such property. 1010 func (this MediaSource) Handle() (ret MediaSourceHandle, ok bool) { 1011 ok = js.True == bindings.GetMediaSourceHandle( 1012 this.ref, js.Pointer(&ret), 1013 ) 1014 return 1015 } 1016 1017 // SourceBuffers returns the value of property "MediaSource.sourceBuffers". 1018 // 1019 // It returns ok=false if there is no such property. 1020 func (this MediaSource) SourceBuffers() (ret SourceBufferList, ok bool) { 1021 ok = js.True == bindings.GetMediaSourceSourceBuffers( 1022 this.ref, js.Pointer(&ret), 1023 ) 1024 return 1025 } 1026 1027 // ActiveSourceBuffers returns the value of property "MediaSource.activeSourceBuffers". 1028 // 1029 // It returns ok=false if there is no such property. 1030 func (this MediaSource) ActiveSourceBuffers() (ret SourceBufferList, ok bool) { 1031 ok = js.True == bindings.GetMediaSourceActiveSourceBuffers( 1032 this.ref, js.Pointer(&ret), 1033 ) 1034 return 1035 } 1036 1037 // ReadyState returns the value of property "MediaSource.readyState". 1038 // 1039 // It returns ok=false if there is no such property. 1040 func (this MediaSource) ReadyState() (ret ReadyState, ok bool) { 1041 ok = js.True == bindings.GetMediaSourceReadyState( 1042 this.ref, js.Pointer(&ret), 1043 ) 1044 return 1045 } 1046 1047 // Duration returns the value of property "MediaSource.duration". 1048 // 1049 // It returns ok=false if there is no such property. 1050 func (this MediaSource) Duration() (ret float64, ok bool) { 1051 ok = js.True == bindings.GetMediaSourceDuration( 1052 this.ref, js.Pointer(&ret), 1053 ) 1054 return 1055 } 1056 1057 // SetDuration sets the value of property "MediaSource.duration" to val. 1058 // 1059 // It returns false if the property cannot be set. 1060 func (this MediaSource) SetDuration(val float64) bool { 1061 return js.True == bindings.SetMediaSourceDuration( 1062 this.ref, 1063 float64(val), 1064 ) 1065 } 1066 1067 // CanConstructInDedicatedWorker returns the value of property "MediaSource.canConstructInDedicatedWorker". 1068 // 1069 // It returns ok=false if there is no such property. 1070 func (this MediaSource) CanConstructInDedicatedWorker() (ret bool, ok bool) { 1071 ok = js.True == bindings.GetMediaSourceCanConstructInDedicatedWorker( 1072 this.ref, js.Pointer(&ret), 1073 ) 1074 return 1075 } 1076 1077 // HasFuncAddSourceBuffer returns true if the method "MediaSource.addSourceBuffer" exists. 1078 func (this MediaSource) HasFuncAddSourceBuffer() bool { 1079 return js.True == bindings.HasFuncMediaSourceAddSourceBuffer( 1080 this.ref, 1081 ) 1082 } 1083 1084 // FuncAddSourceBuffer returns the method "MediaSource.addSourceBuffer". 1085 func (this MediaSource) FuncAddSourceBuffer() (fn js.Func[func(typ js.String) SourceBuffer]) { 1086 bindings.FuncMediaSourceAddSourceBuffer( 1087 this.ref, js.Pointer(&fn), 1088 ) 1089 return 1090 } 1091 1092 // AddSourceBuffer calls the method "MediaSource.addSourceBuffer". 1093 func (this MediaSource) AddSourceBuffer(typ js.String) (ret SourceBuffer) { 1094 bindings.CallMediaSourceAddSourceBuffer( 1095 this.ref, js.Pointer(&ret), 1096 typ.Ref(), 1097 ) 1098 1099 return 1100 } 1101 1102 // TryAddSourceBuffer calls the method "MediaSource.addSourceBuffer" 1103 // in a try/catch block and returns (_, err, ok = false) when it went through 1104 // the catch clause. 1105 func (this MediaSource) TryAddSourceBuffer(typ js.String) (ret SourceBuffer, exception js.Any, ok bool) { 1106 ok = js.True == bindings.TryMediaSourceAddSourceBuffer( 1107 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1108 typ.Ref(), 1109 ) 1110 1111 return 1112 } 1113 1114 // HasFuncRemoveSourceBuffer returns true if the method "MediaSource.removeSourceBuffer" exists. 1115 func (this MediaSource) HasFuncRemoveSourceBuffer() bool { 1116 return js.True == bindings.HasFuncMediaSourceRemoveSourceBuffer( 1117 this.ref, 1118 ) 1119 } 1120 1121 // FuncRemoveSourceBuffer returns the method "MediaSource.removeSourceBuffer". 1122 func (this MediaSource) FuncRemoveSourceBuffer() (fn js.Func[func(sourceBuffer SourceBuffer)]) { 1123 bindings.FuncMediaSourceRemoveSourceBuffer( 1124 this.ref, js.Pointer(&fn), 1125 ) 1126 return 1127 } 1128 1129 // RemoveSourceBuffer calls the method "MediaSource.removeSourceBuffer". 1130 func (this MediaSource) RemoveSourceBuffer(sourceBuffer SourceBuffer) (ret js.Void) { 1131 bindings.CallMediaSourceRemoveSourceBuffer( 1132 this.ref, js.Pointer(&ret), 1133 sourceBuffer.Ref(), 1134 ) 1135 1136 return 1137 } 1138 1139 // TryRemoveSourceBuffer calls the method "MediaSource.removeSourceBuffer" 1140 // in a try/catch block and returns (_, err, ok = false) when it went through 1141 // the catch clause. 1142 func (this MediaSource) TryRemoveSourceBuffer(sourceBuffer SourceBuffer) (ret js.Void, exception js.Any, ok bool) { 1143 ok = js.True == bindings.TryMediaSourceRemoveSourceBuffer( 1144 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1145 sourceBuffer.Ref(), 1146 ) 1147 1148 return 1149 } 1150 1151 // HasFuncEndOfStream returns true if the method "MediaSource.endOfStream" exists. 1152 func (this MediaSource) HasFuncEndOfStream() bool { 1153 return js.True == bindings.HasFuncMediaSourceEndOfStream( 1154 this.ref, 1155 ) 1156 } 1157 1158 // FuncEndOfStream returns the method "MediaSource.endOfStream". 1159 func (this MediaSource) FuncEndOfStream() (fn js.Func[func(err EndOfStreamError)]) { 1160 bindings.FuncMediaSourceEndOfStream( 1161 this.ref, js.Pointer(&fn), 1162 ) 1163 return 1164 } 1165 1166 // EndOfStream calls the method "MediaSource.endOfStream". 1167 func (this MediaSource) EndOfStream(err EndOfStreamError) (ret js.Void) { 1168 bindings.CallMediaSourceEndOfStream( 1169 this.ref, js.Pointer(&ret), 1170 uint32(err), 1171 ) 1172 1173 return 1174 } 1175 1176 // TryEndOfStream calls the method "MediaSource.endOfStream" 1177 // in a try/catch block and returns (_, err, ok = false) when it went through 1178 // the catch clause. 1179 func (this MediaSource) TryEndOfStream(err EndOfStreamError) (ret js.Void, exception js.Any, ok bool) { 1180 ok = js.True == bindings.TryMediaSourceEndOfStream( 1181 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1182 uint32(err), 1183 ) 1184 1185 return 1186 } 1187 1188 // HasFuncEndOfStream1 returns true if the method "MediaSource.endOfStream" exists. 1189 func (this MediaSource) HasFuncEndOfStream1() bool { 1190 return js.True == bindings.HasFuncMediaSourceEndOfStream1( 1191 this.ref, 1192 ) 1193 } 1194 1195 // FuncEndOfStream1 returns the method "MediaSource.endOfStream". 1196 func (this MediaSource) FuncEndOfStream1() (fn js.Func[func()]) { 1197 bindings.FuncMediaSourceEndOfStream1( 1198 this.ref, js.Pointer(&fn), 1199 ) 1200 return 1201 } 1202 1203 // EndOfStream1 calls the method "MediaSource.endOfStream". 1204 func (this MediaSource) EndOfStream1() (ret js.Void) { 1205 bindings.CallMediaSourceEndOfStream1( 1206 this.ref, js.Pointer(&ret), 1207 ) 1208 1209 return 1210 } 1211 1212 // TryEndOfStream1 calls the method "MediaSource.endOfStream" 1213 // in a try/catch block and returns (_, err, ok = false) when it went through 1214 // the catch clause. 1215 func (this MediaSource) TryEndOfStream1() (ret js.Void, exception js.Any, ok bool) { 1216 ok = js.True == bindings.TryMediaSourceEndOfStream1( 1217 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1218 ) 1219 1220 return 1221 } 1222 1223 // HasFuncSetLiveSeekableRange returns true if the method "MediaSource.setLiveSeekableRange" exists. 1224 func (this MediaSource) HasFuncSetLiveSeekableRange() bool { 1225 return js.True == bindings.HasFuncMediaSourceSetLiveSeekableRange( 1226 this.ref, 1227 ) 1228 } 1229 1230 // FuncSetLiveSeekableRange returns the method "MediaSource.setLiveSeekableRange". 1231 func (this MediaSource) FuncSetLiveSeekableRange() (fn js.Func[func(start float64, end float64)]) { 1232 bindings.FuncMediaSourceSetLiveSeekableRange( 1233 this.ref, js.Pointer(&fn), 1234 ) 1235 return 1236 } 1237 1238 // SetLiveSeekableRange calls the method "MediaSource.setLiveSeekableRange". 1239 func (this MediaSource) SetLiveSeekableRange(start float64, end float64) (ret js.Void) { 1240 bindings.CallMediaSourceSetLiveSeekableRange( 1241 this.ref, js.Pointer(&ret), 1242 float64(start), 1243 float64(end), 1244 ) 1245 1246 return 1247 } 1248 1249 // TrySetLiveSeekableRange calls the method "MediaSource.setLiveSeekableRange" 1250 // in a try/catch block and returns (_, err, ok = false) when it went through 1251 // the catch clause. 1252 func (this MediaSource) TrySetLiveSeekableRange(start float64, end float64) (ret js.Void, exception js.Any, ok bool) { 1253 ok = js.True == bindings.TryMediaSourceSetLiveSeekableRange( 1254 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1255 float64(start), 1256 float64(end), 1257 ) 1258 1259 return 1260 } 1261 1262 // HasFuncClearLiveSeekableRange returns true if the method "MediaSource.clearLiveSeekableRange" exists. 1263 func (this MediaSource) HasFuncClearLiveSeekableRange() bool { 1264 return js.True == bindings.HasFuncMediaSourceClearLiveSeekableRange( 1265 this.ref, 1266 ) 1267 } 1268 1269 // FuncClearLiveSeekableRange returns the method "MediaSource.clearLiveSeekableRange". 1270 func (this MediaSource) FuncClearLiveSeekableRange() (fn js.Func[func()]) { 1271 bindings.FuncMediaSourceClearLiveSeekableRange( 1272 this.ref, js.Pointer(&fn), 1273 ) 1274 return 1275 } 1276 1277 // ClearLiveSeekableRange calls the method "MediaSource.clearLiveSeekableRange". 1278 func (this MediaSource) ClearLiveSeekableRange() (ret js.Void) { 1279 bindings.CallMediaSourceClearLiveSeekableRange( 1280 this.ref, js.Pointer(&ret), 1281 ) 1282 1283 return 1284 } 1285 1286 // TryClearLiveSeekableRange calls the method "MediaSource.clearLiveSeekableRange" 1287 // in a try/catch block and returns (_, err, ok = false) when it went through 1288 // the catch clause. 1289 func (this MediaSource) TryClearLiveSeekableRange() (ret js.Void, exception js.Any, ok bool) { 1290 ok = js.True == bindings.TryMediaSourceClearLiveSeekableRange( 1291 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1292 ) 1293 1294 return 1295 } 1296 1297 // HasFuncIsTypeSupported returns true if the static method "MediaSource.isTypeSupported" exists. 1298 func (this MediaSource) HasFuncIsTypeSupported() bool { 1299 return js.True == bindings.HasFuncMediaSourceIsTypeSupported( 1300 this.ref, 1301 ) 1302 } 1303 1304 // FuncIsTypeSupported returns the static method "MediaSource.isTypeSupported". 1305 func (this MediaSource) FuncIsTypeSupported() (fn js.Func[func(typ js.String) bool]) { 1306 bindings.FuncMediaSourceIsTypeSupported( 1307 this.ref, js.Pointer(&fn), 1308 ) 1309 return 1310 } 1311 1312 // IsTypeSupported calls the static method "MediaSource.isTypeSupported". 1313 func (this MediaSource) IsTypeSupported(typ js.String) (ret bool) { 1314 bindings.CallMediaSourceIsTypeSupported( 1315 this.ref, js.Pointer(&ret), 1316 typ.Ref(), 1317 ) 1318 1319 return 1320 } 1321 1322 // TryIsTypeSupported calls the static method "MediaSource.isTypeSupported" 1323 // in a try/catch block and returns (_, err, ok = false) when it went through 1324 // the catch clause. 1325 func (this MediaSource) TryIsTypeSupported(typ js.String) (ret bool, exception js.Any, ok bool) { 1326 ok = js.True == bindings.TryMediaSourceIsTypeSupported( 1327 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1328 typ.Ref(), 1329 ) 1330 1331 return 1332 } 1333 1334 type OneOf_MediaStream_MediaSource_Blob struct { 1335 ref js.Ref 1336 } 1337 1338 func (x OneOf_MediaStream_MediaSource_Blob) Ref() js.Ref { 1339 return x.ref 1340 } 1341 1342 func (x OneOf_MediaStream_MediaSource_Blob) Free() { 1343 x.ref.Free() 1344 } 1345 1346 func (x OneOf_MediaStream_MediaSource_Blob) FromRef(ref js.Ref) OneOf_MediaStream_MediaSource_Blob { 1347 return OneOf_MediaStream_MediaSource_Blob{ 1348 ref: ref, 1349 } 1350 } 1351 1352 func (x OneOf_MediaStream_MediaSource_Blob) MediaStream() MediaStream { 1353 return MediaStream{}.FromRef(x.ref) 1354 } 1355 1356 func (x OneOf_MediaStream_MediaSource_Blob) MediaSource() MediaSource { 1357 return MediaSource{}.FromRef(x.ref) 1358 } 1359 1360 func (x OneOf_MediaStream_MediaSource_Blob) Blob() Blob { 1361 return Blob{}.FromRef(x.ref) 1362 } 1363 1364 type MediaProvider = OneOf_MediaStream_MediaSource_Blob 1365 1366 type RemotePlaybackAvailabilityCallbackFunc func(this js.Ref, available bool) js.Ref 1367 1368 func (fn RemotePlaybackAvailabilityCallbackFunc) Register() js.Func[func(available bool)] { 1369 return js.RegisterCallback[func(available bool)]( 1370 fn, abi.FuncPCABIInternal(fn), 1371 ) 1372 } 1373 1374 func (fn RemotePlaybackAvailabilityCallbackFunc) DispatchCallback( 1375 targetPC uintptr, ctx *js.CallbackContext, 1376 ) { 1377 args := ctx.Args() 1378 if len(args) != 1+1 /* js this */ || 1379 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 1380 js.ThrowInvalidCallbackInvocation() 1381 } 1382 1383 if ctx.Return(fn( 1384 args[0], 1385 1386 args[0+1] == js.True, 1387 )) { 1388 return 1389 } 1390 1391 js.ThrowCallbackValueNotReturned() 1392 } 1393 1394 type RemotePlaybackAvailabilityCallback[T any] struct { 1395 Fn func(arg T, this js.Ref, available bool) js.Ref 1396 Arg T 1397 } 1398 1399 func (cb *RemotePlaybackAvailabilityCallback[T]) Register() js.Func[func(available bool)] { 1400 return js.RegisterCallback[func(available bool)]( 1401 cb, abi.FuncPCABIInternal(cb.Fn), 1402 ) 1403 } 1404 1405 func (cb *RemotePlaybackAvailabilityCallback[T]) DispatchCallback( 1406 targetPC uintptr, ctx *js.CallbackContext, 1407 ) { 1408 args := ctx.Args() 1409 if len(args) != 1+1 /* js this */ || 1410 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 1411 js.ThrowInvalidCallbackInvocation() 1412 } 1413 1414 if ctx.Return(cb.Fn( 1415 cb.Arg, 1416 args[0], 1417 1418 args[0+1] == js.True, 1419 )) { 1420 return 1421 } 1422 1423 js.ThrowCallbackValueNotReturned() 1424 } 1425 1426 type RemotePlaybackState uint32 1427 1428 const ( 1429 _ RemotePlaybackState = iota 1430 1431 RemotePlaybackState_CONNECTING 1432 RemotePlaybackState_CONNECTED 1433 RemotePlaybackState_DISCONNECTED 1434 ) 1435 1436 func (RemotePlaybackState) FromRef(str js.Ref) RemotePlaybackState { 1437 return RemotePlaybackState(bindings.ConstOfRemotePlaybackState(str)) 1438 } 1439 1440 func (x RemotePlaybackState) String() (string, bool) { 1441 switch x { 1442 case RemotePlaybackState_CONNECTING: 1443 return "connecting", true 1444 case RemotePlaybackState_CONNECTED: 1445 return "connected", true 1446 case RemotePlaybackState_DISCONNECTED: 1447 return "disconnected", true 1448 default: 1449 return "", false 1450 } 1451 } 1452 1453 type RemotePlayback struct { 1454 EventTarget 1455 } 1456 1457 func (this RemotePlayback) Once() RemotePlayback { 1458 this.ref.Once() 1459 return this 1460 } 1461 1462 func (this RemotePlayback) Ref() js.Ref { 1463 return this.EventTarget.Ref() 1464 } 1465 1466 func (this RemotePlayback) FromRef(ref js.Ref) RemotePlayback { 1467 this.EventTarget = this.EventTarget.FromRef(ref) 1468 return this 1469 } 1470 1471 func (this RemotePlayback) Free() { 1472 this.ref.Free() 1473 } 1474 1475 // State returns the value of property "RemotePlayback.state". 1476 // 1477 // It returns ok=false if there is no such property. 1478 func (this RemotePlayback) State() (ret RemotePlaybackState, ok bool) { 1479 ok = js.True == bindings.GetRemotePlaybackState( 1480 this.ref, js.Pointer(&ret), 1481 ) 1482 return 1483 } 1484 1485 // HasFuncWatchAvailability returns true if the method "RemotePlayback.watchAvailability" exists. 1486 func (this RemotePlayback) HasFuncWatchAvailability() bool { 1487 return js.True == bindings.HasFuncRemotePlaybackWatchAvailability( 1488 this.ref, 1489 ) 1490 } 1491 1492 // FuncWatchAvailability returns the method "RemotePlayback.watchAvailability". 1493 func (this RemotePlayback) FuncWatchAvailability() (fn js.Func[func(callback js.Func[func(available bool)]) js.Promise[js.Number[int32]]]) { 1494 bindings.FuncRemotePlaybackWatchAvailability( 1495 this.ref, js.Pointer(&fn), 1496 ) 1497 return 1498 } 1499 1500 // WatchAvailability calls the method "RemotePlayback.watchAvailability". 1501 func (this RemotePlayback) WatchAvailability(callback js.Func[func(available bool)]) (ret js.Promise[js.Number[int32]]) { 1502 bindings.CallRemotePlaybackWatchAvailability( 1503 this.ref, js.Pointer(&ret), 1504 callback.Ref(), 1505 ) 1506 1507 return 1508 } 1509 1510 // TryWatchAvailability calls the method "RemotePlayback.watchAvailability" 1511 // in a try/catch block and returns (_, err, ok = false) when it went through 1512 // the catch clause. 1513 func (this RemotePlayback) TryWatchAvailability(callback js.Func[func(available bool)]) (ret js.Promise[js.Number[int32]], exception js.Any, ok bool) { 1514 ok = js.True == bindings.TryRemotePlaybackWatchAvailability( 1515 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1516 callback.Ref(), 1517 ) 1518 1519 return 1520 } 1521 1522 // HasFuncCancelWatchAvailability returns true if the method "RemotePlayback.cancelWatchAvailability" exists. 1523 func (this RemotePlayback) HasFuncCancelWatchAvailability() bool { 1524 return js.True == bindings.HasFuncRemotePlaybackCancelWatchAvailability( 1525 this.ref, 1526 ) 1527 } 1528 1529 // FuncCancelWatchAvailability returns the method "RemotePlayback.cancelWatchAvailability". 1530 func (this RemotePlayback) FuncCancelWatchAvailability() (fn js.Func[func(id int32) js.Promise[js.Void]]) { 1531 bindings.FuncRemotePlaybackCancelWatchAvailability( 1532 this.ref, js.Pointer(&fn), 1533 ) 1534 return 1535 } 1536 1537 // CancelWatchAvailability calls the method "RemotePlayback.cancelWatchAvailability". 1538 func (this RemotePlayback) CancelWatchAvailability(id int32) (ret js.Promise[js.Void]) { 1539 bindings.CallRemotePlaybackCancelWatchAvailability( 1540 this.ref, js.Pointer(&ret), 1541 int32(id), 1542 ) 1543 1544 return 1545 } 1546 1547 // TryCancelWatchAvailability calls the method "RemotePlayback.cancelWatchAvailability" 1548 // in a try/catch block and returns (_, err, ok = false) when it went through 1549 // the catch clause. 1550 func (this RemotePlayback) TryCancelWatchAvailability(id int32) (ret js.Promise[js.Void], exception js.Any, ok bool) { 1551 ok = js.True == bindings.TryRemotePlaybackCancelWatchAvailability( 1552 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1553 int32(id), 1554 ) 1555 1556 return 1557 } 1558 1559 // HasFuncCancelWatchAvailability1 returns true if the method "RemotePlayback.cancelWatchAvailability" exists. 1560 func (this RemotePlayback) HasFuncCancelWatchAvailability1() bool { 1561 return js.True == bindings.HasFuncRemotePlaybackCancelWatchAvailability1( 1562 this.ref, 1563 ) 1564 } 1565 1566 // FuncCancelWatchAvailability1 returns the method "RemotePlayback.cancelWatchAvailability". 1567 func (this RemotePlayback) FuncCancelWatchAvailability1() (fn js.Func[func() js.Promise[js.Void]]) { 1568 bindings.FuncRemotePlaybackCancelWatchAvailability1( 1569 this.ref, js.Pointer(&fn), 1570 ) 1571 return 1572 } 1573 1574 // CancelWatchAvailability1 calls the method "RemotePlayback.cancelWatchAvailability". 1575 func (this RemotePlayback) CancelWatchAvailability1() (ret js.Promise[js.Void]) { 1576 bindings.CallRemotePlaybackCancelWatchAvailability1( 1577 this.ref, js.Pointer(&ret), 1578 ) 1579 1580 return 1581 } 1582 1583 // TryCancelWatchAvailability1 calls the method "RemotePlayback.cancelWatchAvailability" 1584 // in a try/catch block and returns (_, err, ok = false) when it went through 1585 // the catch clause. 1586 func (this RemotePlayback) TryCancelWatchAvailability1() (ret js.Promise[js.Void], exception js.Any, ok bool) { 1587 ok = js.True == bindings.TryRemotePlaybackCancelWatchAvailability1( 1588 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1589 ) 1590 1591 return 1592 } 1593 1594 // HasFuncPrompt returns true if the method "RemotePlayback.prompt" exists. 1595 func (this RemotePlayback) HasFuncPrompt() bool { 1596 return js.True == bindings.HasFuncRemotePlaybackPrompt( 1597 this.ref, 1598 ) 1599 } 1600 1601 // FuncPrompt returns the method "RemotePlayback.prompt". 1602 func (this RemotePlayback) FuncPrompt() (fn js.Func[func() js.Promise[js.Void]]) { 1603 bindings.FuncRemotePlaybackPrompt( 1604 this.ref, js.Pointer(&fn), 1605 ) 1606 return 1607 } 1608 1609 // Prompt calls the method "RemotePlayback.prompt". 1610 func (this RemotePlayback) Prompt() (ret js.Promise[js.Void]) { 1611 bindings.CallRemotePlaybackPrompt( 1612 this.ref, js.Pointer(&ret), 1613 ) 1614 1615 return 1616 } 1617 1618 // TryPrompt calls the method "RemotePlayback.prompt" 1619 // in a try/catch block and returns (_, err, ok = false) when it went through 1620 // the catch clause. 1621 func (this RemotePlayback) TryPrompt() (ret js.Promise[js.Void], exception js.Any, ok bool) { 1622 ok = js.True == bindings.TryRemotePlaybackPrompt( 1623 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1624 ) 1625 1626 return 1627 } 1628 1629 type HTMLMediaElement struct { 1630 HTMLElement 1631 } 1632 1633 func (this HTMLMediaElement) Once() HTMLMediaElement { 1634 this.ref.Once() 1635 return this 1636 } 1637 1638 func (this HTMLMediaElement) Ref() js.Ref { 1639 return this.HTMLElement.Ref() 1640 } 1641 1642 func (this HTMLMediaElement) FromRef(ref js.Ref) HTMLMediaElement { 1643 this.HTMLElement = this.HTMLElement.FromRef(ref) 1644 return this 1645 } 1646 1647 func (this HTMLMediaElement) Free() { 1648 this.ref.Free() 1649 } 1650 1651 // Error returns the value of property "HTMLMediaElement.error". 1652 // 1653 // It returns ok=false if there is no such property. 1654 func (this HTMLMediaElement) Error() (ret MediaError, ok bool) { 1655 ok = js.True == bindings.GetHTMLMediaElementError( 1656 this.ref, js.Pointer(&ret), 1657 ) 1658 return 1659 } 1660 1661 // Src returns the value of property "HTMLMediaElement.src". 1662 // 1663 // It returns ok=false if there is no such property. 1664 func (this HTMLMediaElement) Src() (ret js.String, ok bool) { 1665 ok = js.True == bindings.GetHTMLMediaElementSrc( 1666 this.ref, js.Pointer(&ret), 1667 ) 1668 return 1669 } 1670 1671 // SetSrc sets the value of property "HTMLMediaElement.src" to val. 1672 // 1673 // It returns false if the property cannot be set. 1674 func (this HTMLMediaElement) SetSrc(val js.String) bool { 1675 return js.True == bindings.SetHTMLMediaElementSrc( 1676 this.ref, 1677 val.Ref(), 1678 ) 1679 } 1680 1681 // SrcObject returns the value of property "HTMLMediaElement.srcObject". 1682 // 1683 // It returns ok=false if there is no such property. 1684 func (this HTMLMediaElement) SrcObject() (ret MediaProvider, ok bool) { 1685 ok = js.True == bindings.GetHTMLMediaElementSrcObject( 1686 this.ref, js.Pointer(&ret), 1687 ) 1688 return 1689 } 1690 1691 // SetSrcObject sets the value of property "HTMLMediaElement.srcObject" to val. 1692 // 1693 // It returns false if the property cannot be set. 1694 func (this HTMLMediaElement) SetSrcObject(val MediaProvider) bool { 1695 return js.True == bindings.SetHTMLMediaElementSrcObject( 1696 this.ref, 1697 val.Ref(), 1698 ) 1699 } 1700 1701 // CurrentSrc returns the value of property "HTMLMediaElement.currentSrc". 1702 // 1703 // It returns ok=false if there is no such property. 1704 func (this HTMLMediaElement) CurrentSrc() (ret js.String, ok bool) { 1705 ok = js.True == bindings.GetHTMLMediaElementCurrentSrc( 1706 this.ref, js.Pointer(&ret), 1707 ) 1708 return 1709 } 1710 1711 // CrossOrigin returns the value of property "HTMLMediaElement.crossOrigin". 1712 // 1713 // It returns ok=false if there is no such property. 1714 func (this HTMLMediaElement) CrossOrigin() (ret js.String, ok bool) { 1715 ok = js.True == bindings.GetHTMLMediaElementCrossOrigin( 1716 this.ref, js.Pointer(&ret), 1717 ) 1718 return 1719 } 1720 1721 // SetCrossOrigin sets the value of property "HTMLMediaElement.crossOrigin" to val. 1722 // 1723 // It returns false if the property cannot be set. 1724 func (this HTMLMediaElement) SetCrossOrigin(val js.String) bool { 1725 return js.True == bindings.SetHTMLMediaElementCrossOrigin( 1726 this.ref, 1727 val.Ref(), 1728 ) 1729 } 1730 1731 // NetworkState returns the value of property "HTMLMediaElement.networkState". 1732 // 1733 // It returns ok=false if there is no such property. 1734 func (this HTMLMediaElement) NetworkState() (ret uint16, ok bool) { 1735 ok = js.True == bindings.GetHTMLMediaElementNetworkState( 1736 this.ref, js.Pointer(&ret), 1737 ) 1738 return 1739 } 1740 1741 // Preload returns the value of property "HTMLMediaElement.preload". 1742 // 1743 // It returns ok=false if there is no such property. 1744 func (this HTMLMediaElement) Preload() (ret js.String, ok bool) { 1745 ok = js.True == bindings.GetHTMLMediaElementPreload( 1746 this.ref, js.Pointer(&ret), 1747 ) 1748 return 1749 } 1750 1751 // SetPreload sets the value of property "HTMLMediaElement.preload" to val. 1752 // 1753 // It returns false if the property cannot be set. 1754 func (this HTMLMediaElement) SetPreload(val js.String) bool { 1755 return js.True == bindings.SetHTMLMediaElementPreload( 1756 this.ref, 1757 val.Ref(), 1758 ) 1759 } 1760 1761 // Buffered returns the value of property "HTMLMediaElement.buffered". 1762 // 1763 // It returns ok=false if there is no such property. 1764 func (this HTMLMediaElement) Buffered() (ret TimeRanges, ok bool) { 1765 ok = js.True == bindings.GetHTMLMediaElementBuffered( 1766 this.ref, js.Pointer(&ret), 1767 ) 1768 return 1769 } 1770 1771 // ReadyState returns the value of property "HTMLMediaElement.readyState". 1772 // 1773 // It returns ok=false if there is no such property. 1774 func (this HTMLMediaElement) ReadyState() (ret uint16, ok bool) { 1775 ok = js.True == bindings.GetHTMLMediaElementReadyState( 1776 this.ref, js.Pointer(&ret), 1777 ) 1778 return 1779 } 1780 1781 // Seeking returns the value of property "HTMLMediaElement.seeking". 1782 // 1783 // It returns ok=false if there is no such property. 1784 func (this HTMLMediaElement) Seeking() (ret bool, ok bool) { 1785 ok = js.True == bindings.GetHTMLMediaElementSeeking( 1786 this.ref, js.Pointer(&ret), 1787 ) 1788 return 1789 } 1790 1791 // CurrentTime returns the value of property "HTMLMediaElement.currentTime". 1792 // 1793 // It returns ok=false if there is no such property. 1794 func (this HTMLMediaElement) CurrentTime() (ret float64, ok bool) { 1795 ok = js.True == bindings.GetHTMLMediaElementCurrentTime( 1796 this.ref, js.Pointer(&ret), 1797 ) 1798 return 1799 } 1800 1801 // SetCurrentTime sets the value of property "HTMLMediaElement.currentTime" to val. 1802 // 1803 // It returns false if the property cannot be set. 1804 func (this HTMLMediaElement) SetCurrentTime(val float64) bool { 1805 return js.True == bindings.SetHTMLMediaElementCurrentTime( 1806 this.ref, 1807 float64(val), 1808 ) 1809 } 1810 1811 // Duration returns the value of property "HTMLMediaElement.duration". 1812 // 1813 // It returns ok=false if there is no such property. 1814 func (this HTMLMediaElement) Duration() (ret float64, ok bool) { 1815 ok = js.True == bindings.GetHTMLMediaElementDuration( 1816 this.ref, js.Pointer(&ret), 1817 ) 1818 return 1819 } 1820 1821 // Paused returns the value of property "HTMLMediaElement.paused". 1822 // 1823 // It returns ok=false if there is no such property. 1824 func (this HTMLMediaElement) Paused() (ret bool, ok bool) { 1825 ok = js.True == bindings.GetHTMLMediaElementPaused( 1826 this.ref, js.Pointer(&ret), 1827 ) 1828 return 1829 } 1830 1831 // DefaultPlaybackRate returns the value of property "HTMLMediaElement.defaultPlaybackRate". 1832 // 1833 // It returns ok=false if there is no such property. 1834 func (this HTMLMediaElement) DefaultPlaybackRate() (ret float64, ok bool) { 1835 ok = js.True == bindings.GetHTMLMediaElementDefaultPlaybackRate( 1836 this.ref, js.Pointer(&ret), 1837 ) 1838 return 1839 } 1840 1841 // SetDefaultPlaybackRate sets the value of property "HTMLMediaElement.defaultPlaybackRate" to val. 1842 // 1843 // It returns false if the property cannot be set. 1844 func (this HTMLMediaElement) SetDefaultPlaybackRate(val float64) bool { 1845 return js.True == bindings.SetHTMLMediaElementDefaultPlaybackRate( 1846 this.ref, 1847 float64(val), 1848 ) 1849 } 1850 1851 // PlaybackRate returns the value of property "HTMLMediaElement.playbackRate". 1852 // 1853 // It returns ok=false if there is no such property. 1854 func (this HTMLMediaElement) PlaybackRate() (ret float64, ok bool) { 1855 ok = js.True == bindings.GetHTMLMediaElementPlaybackRate( 1856 this.ref, js.Pointer(&ret), 1857 ) 1858 return 1859 } 1860 1861 // SetPlaybackRate sets the value of property "HTMLMediaElement.playbackRate" to val. 1862 // 1863 // It returns false if the property cannot be set. 1864 func (this HTMLMediaElement) SetPlaybackRate(val float64) bool { 1865 return js.True == bindings.SetHTMLMediaElementPlaybackRate( 1866 this.ref, 1867 float64(val), 1868 ) 1869 } 1870 1871 // PreservesPitch returns the value of property "HTMLMediaElement.preservesPitch". 1872 // 1873 // It returns ok=false if there is no such property. 1874 func (this HTMLMediaElement) PreservesPitch() (ret bool, ok bool) { 1875 ok = js.True == bindings.GetHTMLMediaElementPreservesPitch( 1876 this.ref, js.Pointer(&ret), 1877 ) 1878 return 1879 } 1880 1881 // SetPreservesPitch sets the value of property "HTMLMediaElement.preservesPitch" to val. 1882 // 1883 // It returns false if the property cannot be set. 1884 func (this HTMLMediaElement) SetPreservesPitch(val bool) bool { 1885 return js.True == bindings.SetHTMLMediaElementPreservesPitch( 1886 this.ref, 1887 js.Bool(bool(val)), 1888 ) 1889 } 1890 1891 // Played returns the value of property "HTMLMediaElement.played". 1892 // 1893 // It returns ok=false if there is no such property. 1894 func (this HTMLMediaElement) Played() (ret TimeRanges, ok bool) { 1895 ok = js.True == bindings.GetHTMLMediaElementPlayed( 1896 this.ref, js.Pointer(&ret), 1897 ) 1898 return 1899 } 1900 1901 // Seekable returns the value of property "HTMLMediaElement.seekable". 1902 // 1903 // It returns ok=false if there is no such property. 1904 func (this HTMLMediaElement) Seekable() (ret TimeRanges, ok bool) { 1905 ok = js.True == bindings.GetHTMLMediaElementSeekable( 1906 this.ref, js.Pointer(&ret), 1907 ) 1908 return 1909 } 1910 1911 // Ended returns the value of property "HTMLMediaElement.ended". 1912 // 1913 // It returns ok=false if there is no such property. 1914 func (this HTMLMediaElement) Ended() (ret bool, ok bool) { 1915 ok = js.True == bindings.GetHTMLMediaElementEnded( 1916 this.ref, js.Pointer(&ret), 1917 ) 1918 return 1919 } 1920 1921 // Autoplay returns the value of property "HTMLMediaElement.autoplay". 1922 // 1923 // It returns ok=false if there is no such property. 1924 func (this HTMLMediaElement) Autoplay() (ret bool, ok bool) { 1925 ok = js.True == bindings.GetHTMLMediaElementAutoplay( 1926 this.ref, js.Pointer(&ret), 1927 ) 1928 return 1929 } 1930 1931 // SetAutoplay sets the value of property "HTMLMediaElement.autoplay" to val. 1932 // 1933 // It returns false if the property cannot be set. 1934 func (this HTMLMediaElement) SetAutoplay(val bool) bool { 1935 return js.True == bindings.SetHTMLMediaElementAutoplay( 1936 this.ref, 1937 js.Bool(bool(val)), 1938 ) 1939 } 1940 1941 // Loop returns the value of property "HTMLMediaElement.loop". 1942 // 1943 // It returns ok=false if there is no such property. 1944 func (this HTMLMediaElement) Loop() (ret bool, ok bool) { 1945 ok = js.True == bindings.GetHTMLMediaElementLoop( 1946 this.ref, js.Pointer(&ret), 1947 ) 1948 return 1949 } 1950 1951 // SetLoop sets the value of property "HTMLMediaElement.loop" to val. 1952 // 1953 // It returns false if the property cannot be set. 1954 func (this HTMLMediaElement) SetLoop(val bool) bool { 1955 return js.True == bindings.SetHTMLMediaElementLoop( 1956 this.ref, 1957 js.Bool(bool(val)), 1958 ) 1959 } 1960 1961 // Controls returns the value of property "HTMLMediaElement.controls". 1962 // 1963 // It returns ok=false if there is no such property. 1964 func (this HTMLMediaElement) Controls() (ret bool, ok bool) { 1965 ok = js.True == bindings.GetHTMLMediaElementControls( 1966 this.ref, js.Pointer(&ret), 1967 ) 1968 return 1969 } 1970 1971 // SetControls sets the value of property "HTMLMediaElement.controls" to val. 1972 // 1973 // It returns false if the property cannot be set. 1974 func (this HTMLMediaElement) SetControls(val bool) bool { 1975 return js.True == bindings.SetHTMLMediaElementControls( 1976 this.ref, 1977 js.Bool(bool(val)), 1978 ) 1979 } 1980 1981 // Volume returns the value of property "HTMLMediaElement.volume". 1982 // 1983 // It returns ok=false if there is no such property. 1984 func (this HTMLMediaElement) Volume() (ret float64, ok bool) { 1985 ok = js.True == bindings.GetHTMLMediaElementVolume( 1986 this.ref, js.Pointer(&ret), 1987 ) 1988 return 1989 } 1990 1991 // SetVolume sets the value of property "HTMLMediaElement.volume" to val. 1992 // 1993 // It returns false if the property cannot be set. 1994 func (this HTMLMediaElement) SetVolume(val float64) bool { 1995 return js.True == bindings.SetHTMLMediaElementVolume( 1996 this.ref, 1997 float64(val), 1998 ) 1999 } 2000 2001 // Muted returns the value of property "HTMLMediaElement.muted". 2002 // 2003 // It returns ok=false if there is no such property. 2004 func (this HTMLMediaElement) Muted() (ret bool, ok bool) { 2005 ok = js.True == bindings.GetHTMLMediaElementMuted( 2006 this.ref, js.Pointer(&ret), 2007 ) 2008 return 2009 } 2010 2011 // SetMuted sets the value of property "HTMLMediaElement.muted" to val. 2012 // 2013 // It returns false if the property cannot be set. 2014 func (this HTMLMediaElement) SetMuted(val bool) bool { 2015 return js.True == bindings.SetHTMLMediaElementMuted( 2016 this.ref, 2017 js.Bool(bool(val)), 2018 ) 2019 } 2020 2021 // DefaultMuted returns the value of property "HTMLMediaElement.defaultMuted". 2022 // 2023 // It returns ok=false if there is no such property. 2024 func (this HTMLMediaElement) DefaultMuted() (ret bool, ok bool) { 2025 ok = js.True == bindings.GetHTMLMediaElementDefaultMuted( 2026 this.ref, js.Pointer(&ret), 2027 ) 2028 return 2029 } 2030 2031 // SetDefaultMuted sets the value of property "HTMLMediaElement.defaultMuted" to val. 2032 // 2033 // It returns false if the property cannot be set. 2034 func (this HTMLMediaElement) SetDefaultMuted(val bool) bool { 2035 return js.True == bindings.SetHTMLMediaElementDefaultMuted( 2036 this.ref, 2037 js.Bool(bool(val)), 2038 ) 2039 } 2040 2041 // AudioTracks returns the value of property "HTMLMediaElement.audioTracks". 2042 // 2043 // It returns ok=false if there is no such property. 2044 func (this HTMLMediaElement) AudioTracks() (ret AudioTrackList, ok bool) { 2045 ok = js.True == bindings.GetHTMLMediaElementAudioTracks( 2046 this.ref, js.Pointer(&ret), 2047 ) 2048 return 2049 } 2050 2051 // VideoTracks returns the value of property "HTMLMediaElement.videoTracks". 2052 // 2053 // It returns ok=false if there is no such property. 2054 func (this HTMLMediaElement) VideoTracks() (ret VideoTrackList, ok bool) { 2055 ok = js.True == bindings.GetHTMLMediaElementVideoTracks( 2056 this.ref, js.Pointer(&ret), 2057 ) 2058 return 2059 } 2060 2061 // TextTracks returns the value of property "HTMLMediaElement.textTracks". 2062 // 2063 // It returns ok=false if there is no such property. 2064 func (this HTMLMediaElement) TextTracks() (ret TextTrackList, ok bool) { 2065 ok = js.True == bindings.GetHTMLMediaElementTextTracks( 2066 this.ref, js.Pointer(&ret), 2067 ) 2068 return 2069 } 2070 2071 // MediaKeys returns the value of property "HTMLMediaElement.mediaKeys". 2072 // 2073 // It returns ok=false if there is no such property. 2074 func (this HTMLMediaElement) MediaKeys() (ret MediaKeys, ok bool) { 2075 ok = js.True == bindings.GetHTMLMediaElementMediaKeys( 2076 this.ref, js.Pointer(&ret), 2077 ) 2078 return 2079 } 2080 2081 // Remote returns the value of property "HTMLMediaElement.remote". 2082 // 2083 // It returns ok=false if there is no such property. 2084 func (this HTMLMediaElement) Remote() (ret RemotePlayback, ok bool) { 2085 ok = js.True == bindings.GetHTMLMediaElementRemote( 2086 this.ref, js.Pointer(&ret), 2087 ) 2088 return 2089 } 2090 2091 // DisableRemotePlayback returns the value of property "HTMLMediaElement.disableRemotePlayback". 2092 // 2093 // It returns ok=false if there is no such property. 2094 func (this HTMLMediaElement) DisableRemotePlayback() (ret bool, ok bool) { 2095 ok = js.True == bindings.GetHTMLMediaElementDisableRemotePlayback( 2096 this.ref, js.Pointer(&ret), 2097 ) 2098 return 2099 } 2100 2101 // SetDisableRemotePlayback sets the value of property "HTMLMediaElement.disableRemotePlayback" to val. 2102 // 2103 // It returns false if the property cannot be set. 2104 func (this HTMLMediaElement) SetDisableRemotePlayback(val bool) bool { 2105 return js.True == bindings.SetHTMLMediaElementDisableRemotePlayback( 2106 this.ref, 2107 js.Bool(bool(val)), 2108 ) 2109 } 2110 2111 // SinkId returns the value of property "HTMLMediaElement.sinkId". 2112 // 2113 // It returns ok=false if there is no such property. 2114 func (this HTMLMediaElement) SinkId() (ret js.String, ok bool) { 2115 ok = js.True == bindings.GetHTMLMediaElementSinkId( 2116 this.ref, js.Pointer(&ret), 2117 ) 2118 return 2119 } 2120 2121 // HasFuncLoad returns true if the method "HTMLMediaElement.load" exists. 2122 func (this HTMLMediaElement) HasFuncLoad() bool { 2123 return js.True == bindings.HasFuncHTMLMediaElementLoad( 2124 this.ref, 2125 ) 2126 } 2127 2128 // FuncLoad returns the method "HTMLMediaElement.load". 2129 func (this HTMLMediaElement) FuncLoad() (fn js.Func[func()]) { 2130 bindings.FuncHTMLMediaElementLoad( 2131 this.ref, js.Pointer(&fn), 2132 ) 2133 return 2134 } 2135 2136 // Load calls the method "HTMLMediaElement.load". 2137 func (this HTMLMediaElement) Load() (ret js.Void) { 2138 bindings.CallHTMLMediaElementLoad( 2139 this.ref, js.Pointer(&ret), 2140 ) 2141 2142 return 2143 } 2144 2145 // TryLoad calls the method "HTMLMediaElement.load" 2146 // in a try/catch block and returns (_, err, ok = false) when it went through 2147 // the catch clause. 2148 func (this HTMLMediaElement) TryLoad() (ret js.Void, exception js.Any, ok bool) { 2149 ok = js.True == bindings.TryHTMLMediaElementLoad( 2150 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2151 ) 2152 2153 return 2154 } 2155 2156 // HasFuncCanPlayType returns true if the method "HTMLMediaElement.canPlayType" exists. 2157 func (this HTMLMediaElement) HasFuncCanPlayType() bool { 2158 return js.True == bindings.HasFuncHTMLMediaElementCanPlayType( 2159 this.ref, 2160 ) 2161 } 2162 2163 // FuncCanPlayType returns the method "HTMLMediaElement.canPlayType". 2164 func (this HTMLMediaElement) FuncCanPlayType() (fn js.Func[func(typ js.String) CanPlayTypeResult]) { 2165 bindings.FuncHTMLMediaElementCanPlayType( 2166 this.ref, js.Pointer(&fn), 2167 ) 2168 return 2169 } 2170 2171 // CanPlayType calls the method "HTMLMediaElement.canPlayType". 2172 func (this HTMLMediaElement) CanPlayType(typ js.String) (ret CanPlayTypeResult) { 2173 bindings.CallHTMLMediaElementCanPlayType( 2174 this.ref, js.Pointer(&ret), 2175 typ.Ref(), 2176 ) 2177 2178 return 2179 } 2180 2181 // TryCanPlayType calls the method "HTMLMediaElement.canPlayType" 2182 // in a try/catch block and returns (_, err, ok = false) when it went through 2183 // the catch clause. 2184 func (this HTMLMediaElement) TryCanPlayType(typ js.String) (ret CanPlayTypeResult, exception js.Any, ok bool) { 2185 ok = js.True == bindings.TryHTMLMediaElementCanPlayType( 2186 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2187 typ.Ref(), 2188 ) 2189 2190 return 2191 } 2192 2193 // HasFuncFastSeek returns true if the method "HTMLMediaElement.fastSeek" exists. 2194 func (this HTMLMediaElement) HasFuncFastSeek() bool { 2195 return js.True == bindings.HasFuncHTMLMediaElementFastSeek( 2196 this.ref, 2197 ) 2198 } 2199 2200 // FuncFastSeek returns the method "HTMLMediaElement.fastSeek". 2201 func (this HTMLMediaElement) FuncFastSeek() (fn js.Func[func(time float64)]) { 2202 bindings.FuncHTMLMediaElementFastSeek( 2203 this.ref, js.Pointer(&fn), 2204 ) 2205 return 2206 } 2207 2208 // FastSeek calls the method "HTMLMediaElement.fastSeek". 2209 func (this HTMLMediaElement) FastSeek(time float64) (ret js.Void) { 2210 bindings.CallHTMLMediaElementFastSeek( 2211 this.ref, js.Pointer(&ret), 2212 float64(time), 2213 ) 2214 2215 return 2216 } 2217 2218 // TryFastSeek calls the method "HTMLMediaElement.fastSeek" 2219 // in a try/catch block and returns (_, err, ok = false) when it went through 2220 // the catch clause. 2221 func (this HTMLMediaElement) TryFastSeek(time float64) (ret js.Void, exception js.Any, ok bool) { 2222 ok = js.True == bindings.TryHTMLMediaElementFastSeek( 2223 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2224 float64(time), 2225 ) 2226 2227 return 2228 } 2229 2230 // HasFuncGetStartDate returns true if the method "HTMLMediaElement.getStartDate" exists. 2231 func (this HTMLMediaElement) HasFuncGetStartDate() bool { 2232 return js.True == bindings.HasFuncHTMLMediaElementGetStartDate( 2233 this.ref, 2234 ) 2235 } 2236 2237 // FuncGetStartDate returns the method "HTMLMediaElement.getStartDate". 2238 func (this HTMLMediaElement) FuncGetStartDate() (fn js.Func[func() js.Object]) { 2239 bindings.FuncHTMLMediaElementGetStartDate( 2240 this.ref, js.Pointer(&fn), 2241 ) 2242 return 2243 } 2244 2245 // GetStartDate calls the method "HTMLMediaElement.getStartDate". 2246 func (this HTMLMediaElement) GetStartDate() (ret js.Object) { 2247 bindings.CallHTMLMediaElementGetStartDate( 2248 this.ref, js.Pointer(&ret), 2249 ) 2250 2251 return 2252 } 2253 2254 // TryGetStartDate calls the method "HTMLMediaElement.getStartDate" 2255 // in a try/catch block and returns (_, err, ok = false) when it went through 2256 // the catch clause. 2257 func (this HTMLMediaElement) TryGetStartDate() (ret js.Object, exception js.Any, ok bool) { 2258 ok = js.True == bindings.TryHTMLMediaElementGetStartDate( 2259 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2260 ) 2261 2262 return 2263 } 2264 2265 // HasFuncPlay returns true if the method "HTMLMediaElement.play" exists. 2266 func (this HTMLMediaElement) HasFuncPlay() bool { 2267 return js.True == bindings.HasFuncHTMLMediaElementPlay( 2268 this.ref, 2269 ) 2270 } 2271 2272 // FuncPlay returns the method "HTMLMediaElement.play". 2273 func (this HTMLMediaElement) FuncPlay() (fn js.Func[func() js.Promise[js.Void]]) { 2274 bindings.FuncHTMLMediaElementPlay( 2275 this.ref, js.Pointer(&fn), 2276 ) 2277 return 2278 } 2279 2280 // Play calls the method "HTMLMediaElement.play". 2281 func (this HTMLMediaElement) Play() (ret js.Promise[js.Void]) { 2282 bindings.CallHTMLMediaElementPlay( 2283 this.ref, js.Pointer(&ret), 2284 ) 2285 2286 return 2287 } 2288 2289 // TryPlay calls the method "HTMLMediaElement.play" 2290 // in a try/catch block and returns (_, err, ok = false) when it went through 2291 // the catch clause. 2292 func (this HTMLMediaElement) TryPlay() (ret js.Promise[js.Void], exception js.Any, ok bool) { 2293 ok = js.True == bindings.TryHTMLMediaElementPlay( 2294 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2295 ) 2296 2297 return 2298 } 2299 2300 // HasFuncPause returns true if the method "HTMLMediaElement.pause" exists. 2301 func (this HTMLMediaElement) HasFuncPause() bool { 2302 return js.True == bindings.HasFuncHTMLMediaElementPause( 2303 this.ref, 2304 ) 2305 } 2306 2307 // FuncPause returns the method "HTMLMediaElement.pause". 2308 func (this HTMLMediaElement) FuncPause() (fn js.Func[func()]) { 2309 bindings.FuncHTMLMediaElementPause( 2310 this.ref, js.Pointer(&fn), 2311 ) 2312 return 2313 } 2314 2315 // Pause calls the method "HTMLMediaElement.pause". 2316 func (this HTMLMediaElement) Pause() (ret js.Void) { 2317 bindings.CallHTMLMediaElementPause( 2318 this.ref, js.Pointer(&ret), 2319 ) 2320 2321 return 2322 } 2323 2324 // TryPause calls the method "HTMLMediaElement.pause" 2325 // in a try/catch block and returns (_, err, ok = false) when it went through 2326 // the catch clause. 2327 func (this HTMLMediaElement) TryPause() (ret js.Void, exception js.Any, ok bool) { 2328 ok = js.True == bindings.TryHTMLMediaElementPause( 2329 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2330 ) 2331 2332 return 2333 } 2334 2335 // HasFuncAddTextTrack returns true if the method "HTMLMediaElement.addTextTrack" exists. 2336 func (this HTMLMediaElement) HasFuncAddTextTrack() bool { 2337 return js.True == bindings.HasFuncHTMLMediaElementAddTextTrack( 2338 this.ref, 2339 ) 2340 } 2341 2342 // FuncAddTextTrack returns the method "HTMLMediaElement.addTextTrack". 2343 func (this HTMLMediaElement) FuncAddTextTrack() (fn js.Func[func(kind TextTrackKind, label js.String, language js.String) TextTrack]) { 2344 bindings.FuncHTMLMediaElementAddTextTrack( 2345 this.ref, js.Pointer(&fn), 2346 ) 2347 return 2348 } 2349 2350 // AddTextTrack calls the method "HTMLMediaElement.addTextTrack". 2351 func (this HTMLMediaElement) AddTextTrack(kind TextTrackKind, label js.String, language js.String) (ret TextTrack) { 2352 bindings.CallHTMLMediaElementAddTextTrack( 2353 this.ref, js.Pointer(&ret), 2354 uint32(kind), 2355 label.Ref(), 2356 language.Ref(), 2357 ) 2358 2359 return 2360 } 2361 2362 // TryAddTextTrack calls the method "HTMLMediaElement.addTextTrack" 2363 // in a try/catch block and returns (_, err, ok = false) when it went through 2364 // the catch clause. 2365 func (this HTMLMediaElement) TryAddTextTrack(kind TextTrackKind, label js.String, language js.String) (ret TextTrack, exception js.Any, ok bool) { 2366 ok = js.True == bindings.TryHTMLMediaElementAddTextTrack( 2367 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2368 uint32(kind), 2369 label.Ref(), 2370 language.Ref(), 2371 ) 2372 2373 return 2374 } 2375 2376 // HasFuncAddTextTrack1 returns true if the method "HTMLMediaElement.addTextTrack" exists. 2377 func (this HTMLMediaElement) HasFuncAddTextTrack1() bool { 2378 return js.True == bindings.HasFuncHTMLMediaElementAddTextTrack1( 2379 this.ref, 2380 ) 2381 } 2382 2383 // FuncAddTextTrack1 returns the method "HTMLMediaElement.addTextTrack". 2384 func (this HTMLMediaElement) FuncAddTextTrack1() (fn js.Func[func(kind TextTrackKind, label js.String) TextTrack]) { 2385 bindings.FuncHTMLMediaElementAddTextTrack1( 2386 this.ref, js.Pointer(&fn), 2387 ) 2388 return 2389 } 2390 2391 // AddTextTrack1 calls the method "HTMLMediaElement.addTextTrack". 2392 func (this HTMLMediaElement) AddTextTrack1(kind TextTrackKind, label js.String) (ret TextTrack) { 2393 bindings.CallHTMLMediaElementAddTextTrack1( 2394 this.ref, js.Pointer(&ret), 2395 uint32(kind), 2396 label.Ref(), 2397 ) 2398 2399 return 2400 } 2401 2402 // TryAddTextTrack1 calls the method "HTMLMediaElement.addTextTrack" 2403 // in a try/catch block and returns (_, err, ok = false) when it went through 2404 // the catch clause. 2405 func (this HTMLMediaElement) TryAddTextTrack1(kind TextTrackKind, label js.String) (ret TextTrack, exception js.Any, ok bool) { 2406 ok = js.True == bindings.TryHTMLMediaElementAddTextTrack1( 2407 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2408 uint32(kind), 2409 label.Ref(), 2410 ) 2411 2412 return 2413 } 2414 2415 // HasFuncAddTextTrack2 returns true if the method "HTMLMediaElement.addTextTrack" exists. 2416 func (this HTMLMediaElement) HasFuncAddTextTrack2() bool { 2417 return js.True == bindings.HasFuncHTMLMediaElementAddTextTrack2( 2418 this.ref, 2419 ) 2420 } 2421 2422 // FuncAddTextTrack2 returns the method "HTMLMediaElement.addTextTrack". 2423 func (this HTMLMediaElement) FuncAddTextTrack2() (fn js.Func[func(kind TextTrackKind) TextTrack]) { 2424 bindings.FuncHTMLMediaElementAddTextTrack2( 2425 this.ref, js.Pointer(&fn), 2426 ) 2427 return 2428 } 2429 2430 // AddTextTrack2 calls the method "HTMLMediaElement.addTextTrack". 2431 func (this HTMLMediaElement) AddTextTrack2(kind TextTrackKind) (ret TextTrack) { 2432 bindings.CallHTMLMediaElementAddTextTrack2( 2433 this.ref, js.Pointer(&ret), 2434 uint32(kind), 2435 ) 2436 2437 return 2438 } 2439 2440 // TryAddTextTrack2 calls the method "HTMLMediaElement.addTextTrack" 2441 // in a try/catch block and returns (_, err, ok = false) when it went through 2442 // the catch clause. 2443 func (this HTMLMediaElement) TryAddTextTrack2(kind TextTrackKind) (ret TextTrack, exception js.Any, ok bool) { 2444 ok = js.True == bindings.TryHTMLMediaElementAddTextTrack2( 2445 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2446 uint32(kind), 2447 ) 2448 2449 return 2450 } 2451 2452 // HasFuncSetMediaKeys returns true if the method "HTMLMediaElement.setMediaKeys" exists. 2453 func (this HTMLMediaElement) HasFuncSetMediaKeys() bool { 2454 return js.True == bindings.HasFuncHTMLMediaElementSetMediaKeys( 2455 this.ref, 2456 ) 2457 } 2458 2459 // FuncSetMediaKeys returns the method "HTMLMediaElement.setMediaKeys". 2460 func (this HTMLMediaElement) FuncSetMediaKeys() (fn js.Func[func(mediaKeys MediaKeys) js.Promise[js.Void]]) { 2461 bindings.FuncHTMLMediaElementSetMediaKeys( 2462 this.ref, js.Pointer(&fn), 2463 ) 2464 return 2465 } 2466 2467 // SetMediaKeys calls the method "HTMLMediaElement.setMediaKeys". 2468 func (this HTMLMediaElement) SetMediaKeys(mediaKeys MediaKeys) (ret js.Promise[js.Void]) { 2469 bindings.CallHTMLMediaElementSetMediaKeys( 2470 this.ref, js.Pointer(&ret), 2471 mediaKeys.Ref(), 2472 ) 2473 2474 return 2475 } 2476 2477 // TrySetMediaKeys calls the method "HTMLMediaElement.setMediaKeys" 2478 // in a try/catch block and returns (_, err, ok = false) when it went through 2479 // the catch clause. 2480 func (this HTMLMediaElement) TrySetMediaKeys(mediaKeys MediaKeys) (ret js.Promise[js.Void], exception js.Any, ok bool) { 2481 ok = js.True == bindings.TryHTMLMediaElementSetMediaKeys( 2482 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2483 mediaKeys.Ref(), 2484 ) 2485 2486 return 2487 } 2488 2489 // HasFuncCaptureStream returns true if the method "HTMLMediaElement.captureStream" exists. 2490 func (this HTMLMediaElement) HasFuncCaptureStream() bool { 2491 return js.True == bindings.HasFuncHTMLMediaElementCaptureStream( 2492 this.ref, 2493 ) 2494 } 2495 2496 // FuncCaptureStream returns the method "HTMLMediaElement.captureStream". 2497 func (this HTMLMediaElement) FuncCaptureStream() (fn js.Func[func() MediaStream]) { 2498 bindings.FuncHTMLMediaElementCaptureStream( 2499 this.ref, js.Pointer(&fn), 2500 ) 2501 return 2502 } 2503 2504 // CaptureStream calls the method "HTMLMediaElement.captureStream". 2505 func (this HTMLMediaElement) CaptureStream() (ret MediaStream) { 2506 bindings.CallHTMLMediaElementCaptureStream( 2507 this.ref, js.Pointer(&ret), 2508 ) 2509 2510 return 2511 } 2512 2513 // TryCaptureStream calls the method "HTMLMediaElement.captureStream" 2514 // in a try/catch block and returns (_, err, ok = false) when it went through 2515 // the catch clause. 2516 func (this HTMLMediaElement) TryCaptureStream() (ret MediaStream, exception js.Any, ok bool) { 2517 ok = js.True == bindings.TryHTMLMediaElementCaptureStream( 2518 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2519 ) 2520 2521 return 2522 } 2523 2524 // HasFuncSetSinkId returns true if the method "HTMLMediaElement.setSinkId" exists. 2525 func (this HTMLMediaElement) HasFuncSetSinkId() bool { 2526 return js.True == bindings.HasFuncHTMLMediaElementSetSinkId( 2527 this.ref, 2528 ) 2529 } 2530 2531 // FuncSetSinkId returns the method "HTMLMediaElement.setSinkId". 2532 func (this HTMLMediaElement) FuncSetSinkId() (fn js.Func[func(sinkId js.String) js.Promise[js.Void]]) { 2533 bindings.FuncHTMLMediaElementSetSinkId( 2534 this.ref, js.Pointer(&fn), 2535 ) 2536 return 2537 } 2538 2539 // SetSinkId calls the method "HTMLMediaElement.setSinkId". 2540 func (this HTMLMediaElement) SetSinkId(sinkId js.String) (ret js.Promise[js.Void]) { 2541 bindings.CallHTMLMediaElementSetSinkId( 2542 this.ref, js.Pointer(&ret), 2543 sinkId.Ref(), 2544 ) 2545 2546 return 2547 } 2548 2549 // TrySetSinkId calls the method "HTMLMediaElement.setSinkId" 2550 // in a try/catch block and returns (_, err, ok = false) when it went through 2551 // the catch clause. 2552 func (this HTMLMediaElement) TrySetSinkId(sinkId js.String) (ret js.Promise[js.Void], exception js.Any, ok bool) { 2553 ok = js.True == bindings.TryHTMLMediaElementSetSinkId( 2554 this.ref, js.Pointer(&ret), js.Pointer(&exception), 2555 sinkId.Ref(), 2556 ) 2557 2558 return 2559 } 2560 2561 type MediaElementAudioSourceOptions struct { 2562 // MediaElement is "MediaElementAudioSourceOptions.mediaElement" 2563 // 2564 // Required 2565 MediaElement HTMLMediaElement 2566 2567 FFI_USE bool 2568 } 2569 2570 // FromRef calls UpdateFrom and returns a MediaElementAudioSourceOptions with all fields set. 2571 func (p MediaElementAudioSourceOptions) FromRef(ref js.Ref) MediaElementAudioSourceOptions { 2572 p.UpdateFrom(ref) 2573 return p 2574 } 2575 2576 // New creates a new MediaElementAudioSourceOptions in the application heap. 2577 func (p MediaElementAudioSourceOptions) New() js.Ref { 2578 return bindings.MediaElementAudioSourceOptionsJSLoad( 2579 js.Pointer(&p), js.True, 0, 2580 ) 2581 } 2582 2583 // UpdateFrom copies value of all fields of the heap object to p. 2584 func (p *MediaElementAudioSourceOptions) UpdateFrom(ref js.Ref) { 2585 bindings.MediaElementAudioSourceOptionsJSStore( 2586 js.Pointer(p), ref, 2587 ) 2588 } 2589 2590 // Update writes all fields of the p to the heap object referenced by ref. 2591 func (p *MediaElementAudioSourceOptions) Update(ref js.Ref) { 2592 bindings.MediaElementAudioSourceOptionsJSLoad( 2593 js.Pointer(p), js.False, ref, 2594 ) 2595 } 2596 2597 // FreeMembers frees fields with heap reference, if recursive is true 2598 // free all heap references reachable from p. 2599 func (p *MediaElementAudioSourceOptions) FreeMembers(recursive bool) { 2600 js.Free( 2601 p.MediaElement.Ref(), 2602 ) 2603 p.MediaElement = p.MediaElement.FromRef(js.Undefined) 2604 } 2605 2606 func NewMediaElementAudioSourceNode(context AudioContext, options MediaElementAudioSourceOptions) (ret MediaElementAudioSourceNode) { 2607 ret.ref = bindings.NewMediaElementAudioSourceNodeByMediaElementAudioSourceNode( 2608 context.Ref(), 2609 js.Pointer(&options)) 2610 return 2611 } 2612 2613 type MediaElementAudioSourceNode struct { 2614 AudioNode 2615 } 2616 2617 func (this MediaElementAudioSourceNode) Once() MediaElementAudioSourceNode { 2618 this.ref.Once() 2619 return this 2620 } 2621 2622 func (this MediaElementAudioSourceNode) Ref() js.Ref { 2623 return this.AudioNode.Ref() 2624 } 2625 2626 func (this MediaElementAudioSourceNode) FromRef(ref js.Ref) MediaElementAudioSourceNode { 2627 this.AudioNode = this.AudioNode.FromRef(ref) 2628 return this 2629 } 2630 2631 func (this MediaElementAudioSourceNode) Free() { 2632 this.ref.Free() 2633 } 2634 2635 // MediaElement returns the value of property "MediaElementAudioSourceNode.mediaElement". 2636 // 2637 // It returns ok=false if there is no such property. 2638 func (this MediaElementAudioSourceNode) MediaElement() (ret HTMLMediaElement, ok bool) { 2639 ok = js.True == bindings.GetMediaElementAudioSourceNodeMediaElement( 2640 this.ref, js.Pointer(&ret), 2641 ) 2642 return 2643 } 2644 2645 type MediaStreamAudioSourceOptions struct { 2646 // MediaStream is "MediaStreamAudioSourceOptions.mediaStream" 2647 // 2648 // Required 2649 MediaStream MediaStream 2650 2651 FFI_USE bool 2652 } 2653 2654 // FromRef calls UpdateFrom and returns a MediaStreamAudioSourceOptions with all fields set. 2655 func (p MediaStreamAudioSourceOptions) FromRef(ref js.Ref) MediaStreamAudioSourceOptions { 2656 p.UpdateFrom(ref) 2657 return p 2658 } 2659 2660 // New creates a new MediaStreamAudioSourceOptions in the application heap. 2661 func (p MediaStreamAudioSourceOptions) New() js.Ref { 2662 return bindings.MediaStreamAudioSourceOptionsJSLoad( 2663 js.Pointer(&p), js.True, 0, 2664 ) 2665 } 2666 2667 // UpdateFrom copies value of all fields of the heap object to p. 2668 func (p *MediaStreamAudioSourceOptions) UpdateFrom(ref js.Ref) { 2669 bindings.MediaStreamAudioSourceOptionsJSStore( 2670 js.Pointer(p), ref, 2671 ) 2672 } 2673 2674 // Update writes all fields of the p to the heap object referenced by ref. 2675 func (p *MediaStreamAudioSourceOptions) Update(ref js.Ref) { 2676 bindings.MediaStreamAudioSourceOptionsJSLoad( 2677 js.Pointer(p), js.False, ref, 2678 ) 2679 } 2680 2681 // FreeMembers frees fields with heap reference, if recursive is true 2682 // free all heap references reachable from p. 2683 func (p *MediaStreamAudioSourceOptions) FreeMembers(recursive bool) { 2684 js.Free( 2685 p.MediaStream.Ref(), 2686 ) 2687 p.MediaStream = p.MediaStream.FromRef(js.Undefined) 2688 } 2689 2690 func NewMediaStreamAudioSourceNode(context AudioContext, options MediaStreamAudioSourceOptions) (ret MediaStreamAudioSourceNode) { 2691 ret.ref = bindings.NewMediaStreamAudioSourceNodeByMediaStreamAudioSourceNode( 2692 context.Ref(), 2693 js.Pointer(&options)) 2694 return 2695 } 2696 2697 type MediaStreamAudioSourceNode struct { 2698 AudioNode 2699 } 2700 2701 func (this MediaStreamAudioSourceNode) Once() MediaStreamAudioSourceNode { 2702 this.ref.Once() 2703 return this 2704 } 2705 2706 func (this MediaStreamAudioSourceNode) Ref() js.Ref { 2707 return this.AudioNode.Ref() 2708 } 2709 2710 func (this MediaStreamAudioSourceNode) FromRef(ref js.Ref) MediaStreamAudioSourceNode { 2711 this.AudioNode = this.AudioNode.FromRef(ref) 2712 return this 2713 } 2714 2715 func (this MediaStreamAudioSourceNode) Free() { 2716 this.ref.Free() 2717 } 2718 2719 // MediaStream returns the value of property "MediaStreamAudioSourceNode.mediaStream". 2720 // 2721 // It returns ok=false if there is no such property. 2722 func (this MediaStreamAudioSourceNode) MediaStream() (ret MediaStream, ok bool) { 2723 ok = js.True == bindings.GetMediaStreamAudioSourceNodeMediaStream( 2724 this.ref, js.Pointer(&ret), 2725 ) 2726 return 2727 } 2728 2729 type MediaStreamTrackAudioSourceOptions struct { 2730 // MediaStreamTrack is "MediaStreamTrackAudioSourceOptions.mediaStreamTrack" 2731 // 2732 // Required 2733 MediaStreamTrack MediaStreamTrack 2734 2735 FFI_USE bool 2736 } 2737 2738 // FromRef calls UpdateFrom and returns a MediaStreamTrackAudioSourceOptions with all fields set. 2739 func (p MediaStreamTrackAudioSourceOptions) FromRef(ref js.Ref) MediaStreamTrackAudioSourceOptions { 2740 p.UpdateFrom(ref) 2741 return p 2742 } 2743 2744 // New creates a new MediaStreamTrackAudioSourceOptions in the application heap. 2745 func (p MediaStreamTrackAudioSourceOptions) New() js.Ref { 2746 return bindings.MediaStreamTrackAudioSourceOptionsJSLoad( 2747 js.Pointer(&p), js.True, 0, 2748 ) 2749 } 2750 2751 // UpdateFrom copies value of all fields of the heap object to p. 2752 func (p *MediaStreamTrackAudioSourceOptions) UpdateFrom(ref js.Ref) { 2753 bindings.MediaStreamTrackAudioSourceOptionsJSStore( 2754 js.Pointer(p), ref, 2755 ) 2756 } 2757 2758 // Update writes all fields of the p to the heap object referenced by ref. 2759 func (p *MediaStreamTrackAudioSourceOptions) Update(ref js.Ref) { 2760 bindings.MediaStreamTrackAudioSourceOptionsJSLoad( 2761 js.Pointer(p), js.False, ref, 2762 ) 2763 } 2764 2765 // FreeMembers frees fields with heap reference, if recursive is true 2766 // free all heap references reachable from p. 2767 func (p *MediaStreamTrackAudioSourceOptions) FreeMembers(recursive bool) { 2768 js.Free( 2769 p.MediaStreamTrack.Ref(), 2770 ) 2771 p.MediaStreamTrack = p.MediaStreamTrack.FromRef(js.Undefined) 2772 } 2773 2774 func NewMediaStreamTrackAudioSourceNode(context AudioContext, options MediaStreamTrackAudioSourceOptions) (ret MediaStreamTrackAudioSourceNode) { 2775 ret.ref = bindings.NewMediaStreamTrackAudioSourceNodeByMediaStreamTrackAudioSourceNode( 2776 context.Ref(), 2777 js.Pointer(&options)) 2778 return 2779 } 2780 2781 type MediaStreamTrackAudioSourceNode struct { 2782 AudioNode 2783 } 2784 2785 func (this MediaStreamTrackAudioSourceNode) Once() MediaStreamTrackAudioSourceNode { 2786 this.ref.Once() 2787 return this 2788 } 2789 2790 func (this MediaStreamTrackAudioSourceNode) Ref() js.Ref { 2791 return this.AudioNode.Ref() 2792 } 2793 2794 func (this MediaStreamTrackAudioSourceNode) FromRef(ref js.Ref) MediaStreamTrackAudioSourceNode { 2795 this.AudioNode = this.AudioNode.FromRef(ref) 2796 return this 2797 } 2798 2799 func (this MediaStreamTrackAudioSourceNode) Free() { 2800 this.ref.Free() 2801 } 2802 2803 type AudioNodeOptions struct { 2804 // ChannelCount is "AudioNodeOptions.channelCount" 2805 // 2806 // Optional 2807 // 2808 // NOTE: FFI_USE_ChannelCount MUST be set to true to make this field effective. 2809 ChannelCount uint32 2810 // ChannelCountMode is "AudioNodeOptions.channelCountMode" 2811 // 2812 // Optional 2813 ChannelCountMode ChannelCountMode 2814 // ChannelInterpretation is "AudioNodeOptions.channelInterpretation" 2815 // 2816 // Optional 2817 ChannelInterpretation ChannelInterpretation 2818 2819 FFI_USE_ChannelCount bool // for ChannelCount. 2820 2821 FFI_USE bool 2822 } 2823 2824 // FromRef calls UpdateFrom and returns a AudioNodeOptions with all fields set. 2825 func (p AudioNodeOptions) FromRef(ref js.Ref) AudioNodeOptions { 2826 p.UpdateFrom(ref) 2827 return p 2828 } 2829 2830 // New creates a new AudioNodeOptions in the application heap. 2831 func (p AudioNodeOptions) New() js.Ref { 2832 return bindings.AudioNodeOptionsJSLoad( 2833 js.Pointer(&p), js.True, 0, 2834 ) 2835 } 2836 2837 // UpdateFrom copies value of all fields of the heap object to p. 2838 func (p *AudioNodeOptions) UpdateFrom(ref js.Ref) { 2839 bindings.AudioNodeOptionsJSStore( 2840 js.Pointer(p), ref, 2841 ) 2842 } 2843 2844 // Update writes all fields of the p to the heap object referenced by ref. 2845 func (p *AudioNodeOptions) Update(ref js.Ref) { 2846 bindings.AudioNodeOptionsJSLoad( 2847 js.Pointer(p), js.False, ref, 2848 ) 2849 } 2850 2851 // FreeMembers frees fields with heap reference, if recursive is true 2852 // free all heap references reachable from p. 2853 func (p *AudioNodeOptions) FreeMembers(recursive bool) { 2854 } 2855 2856 func NewMediaStreamAudioDestinationNode(context AudioContext, options AudioNodeOptions) (ret MediaStreamAudioDestinationNode) { 2857 ret.ref = bindings.NewMediaStreamAudioDestinationNodeByMediaStreamAudioDestinationNode( 2858 context.Ref(), 2859 js.Pointer(&options)) 2860 return 2861 } 2862 2863 func NewMediaStreamAudioDestinationNodeByMediaStreamAudioDestinationNode1(context AudioContext) (ret MediaStreamAudioDestinationNode) { 2864 ret.ref = bindings.NewMediaStreamAudioDestinationNodeByMediaStreamAudioDestinationNode1( 2865 context.Ref()) 2866 return 2867 } 2868 2869 type MediaStreamAudioDestinationNode struct { 2870 AudioNode 2871 } 2872 2873 func (this MediaStreamAudioDestinationNode) Once() MediaStreamAudioDestinationNode { 2874 this.ref.Once() 2875 return this 2876 } 2877 2878 func (this MediaStreamAudioDestinationNode) Ref() js.Ref { 2879 return this.AudioNode.Ref() 2880 } 2881 2882 func (this MediaStreamAudioDestinationNode) FromRef(ref js.Ref) MediaStreamAudioDestinationNode { 2883 this.AudioNode = this.AudioNode.FromRef(ref) 2884 return this 2885 } 2886 2887 func (this MediaStreamAudioDestinationNode) Free() { 2888 this.ref.Free() 2889 } 2890 2891 // Stream returns the value of property "MediaStreamAudioDestinationNode.stream". 2892 // 2893 // It returns ok=false if there is no such property. 2894 func (this MediaStreamAudioDestinationNode) Stream() (ret MediaStream, ok bool) { 2895 ok = js.True == bindings.GetMediaStreamAudioDestinationNodeStream( 2896 this.ref, js.Pointer(&ret), 2897 ) 2898 return 2899 } 2900 2901 type AudioSinkInfo struct { 2902 ref js.Ref 2903 } 2904 2905 func (this AudioSinkInfo) Once() AudioSinkInfo { 2906 this.ref.Once() 2907 return this 2908 } 2909 2910 func (this AudioSinkInfo) Ref() js.Ref { 2911 return this.ref 2912 } 2913 2914 func (this AudioSinkInfo) FromRef(ref js.Ref) AudioSinkInfo { 2915 this.ref = ref 2916 return this 2917 } 2918 2919 func (this AudioSinkInfo) Free() { 2920 this.ref.Free() 2921 } 2922 2923 // Type returns the value of property "AudioSinkInfo.type". 2924 // 2925 // It returns ok=false if there is no such property. 2926 func (this AudioSinkInfo) Type() (ret AudioSinkType, ok bool) { 2927 ok = js.True == bindings.GetAudioSinkInfoType( 2928 this.ref, js.Pointer(&ret), 2929 ) 2930 return 2931 } 2932 2933 type OneOf_String_AudioSinkInfo struct { 2934 ref js.Ref 2935 } 2936 2937 func (x OneOf_String_AudioSinkInfo) Ref() js.Ref { 2938 return x.ref 2939 } 2940 2941 func (x OneOf_String_AudioSinkInfo) Free() { 2942 x.ref.Free() 2943 } 2944 2945 func (x OneOf_String_AudioSinkInfo) FromRef(ref js.Ref) OneOf_String_AudioSinkInfo { 2946 return OneOf_String_AudioSinkInfo{ 2947 ref: ref, 2948 } 2949 } 2950 2951 func (x OneOf_String_AudioSinkInfo) String() js.String { 2952 return js.String{}.FromRef(x.ref) 2953 } 2954 2955 func (x OneOf_String_AudioSinkInfo) AudioSinkInfo() AudioSinkInfo { 2956 return AudioSinkInfo{}.FromRef(x.ref) 2957 } 2958 2959 type AudioRenderCapacityOptions struct { 2960 // UpdateInterval is "AudioRenderCapacityOptions.updateInterval" 2961 // 2962 // Optional, defaults to 1. 2963 // 2964 // NOTE: FFI_USE_UpdateInterval MUST be set to true to make this field effective. 2965 UpdateInterval float64 2966 2967 FFI_USE_UpdateInterval bool // for UpdateInterval. 2968 2969 FFI_USE bool 2970 } 2971 2972 // FromRef calls UpdateFrom and returns a AudioRenderCapacityOptions with all fields set. 2973 func (p AudioRenderCapacityOptions) FromRef(ref js.Ref) AudioRenderCapacityOptions { 2974 p.UpdateFrom(ref) 2975 return p 2976 } 2977 2978 // New creates a new AudioRenderCapacityOptions in the application heap. 2979 func (p AudioRenderCapacityOptions) New() js.Ref { 2980 return bindings.AudioRenderCapacityOptionsJSLoad( 2981 js.Pointer(&p), js.True, 0, 2982 ) 2983 } 2984 2985 // UpdateFrom copies value of all fields of the heap object to p. 2986 func (p *AudioRenderCapacityOptions) UpdateFrom(ref js.Ref) { 2987 bindings.AudioRenderCapacityOptionsJSStore( 2988 js.Pointer(p), ref, 2989 ) 2990 } 2991 2992 // Update writes all fields of the p to the heap object referenced by ref. 2993 func (p *AudioRenderCapacityOptions) Update(ref js.Ref) { 2994 bindings.AudioRenderCapacityOptionsJSLoad( 2995 js.Pointer(p), js.False, ref, 2996 ) 2997 } 2998 2999 // FreeMembers frees fields with heap reference, if recursive is true 3000 // free all heap references reachable from p. 3001 func (p *AudioRenderCapacityOptions) FreeMembers(recursive bool) { 3002 } 3003 3004 type AudioRenderCapacity struct { 3005 EventTarget 3006 } 3007 3008 func (this AudioRenderCapacity) Once() AudioRenderCapacity { 3009 this.ref.Once() 3010 return this 3011 } 3012 3013 func (this AudioRenderCapacity) Ref() js.Ref { 3014 return this.EventTarget.Ref() 3015 } 3016 3017 func (this AudioRenderCapacity) FromRef(ref js.Ref) AudioRenderCapacity { 3018 this.EventTarget = this.EventTarget.FromRef(ref) 3019 return this 3020 } 3021 3022 func (this AudioRenderCapacity) Free() { 3023 this.ref.Free() 3024 } 3025 3026 // HasFuncStart returns true if the method "AudioRenderCapacity.start" exists. 3027 func (this AudioRenderCapacity) HasFuncStart() bool { 3028 return js.True == bindings.HasFuncAudioRenderCapacityStart( 3029 this.ref, 3030 ) 3031 } 3032 3033 // FuncStart returns the method "AudioRenderCapacity.start". 3034 func (this AudioRenderCapacity) FuncStart() (fn js.Func[func(options AudioRenderCapacityOptions)]) { 3035 bindings.FuncAudioRenderCapacityStart( 3036 this.ref, js.Pointer(&fn), 3037 ) 3038 return 3039 } 3040 3041 // Start calls the method "AudioRenderCapacity.start". 3042 func (this AudioRenderCapacity) Start(options AudioRenderCapacityOptions) (ret js.Void) { 3043 bindings.CallAudioRenderCapacityStart( 3044 this.ref, js.Pointer(&ret), 3045 js.Pointer(&options), 3046 ) 3047 3048 return 3049 } 3050 3051 // TryStart calls the method "AudioRenderCapacity.start" 3052 // in a try/catch block and returns (_, err, ok = false) when it went through 3053 // the catch clause. 3054 func (this AudioRenderCapacity) TryStart(options AudioRenderCapacityOptions) (ret js.Void, exception js.Any, ok bool) { 3055 ok = js.True == bindings.TryAudioRenderCapacityStart( 3056 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3057 js.Pointer(&options), 3058 ) 3059 3060 return 3061 } 3062 3063 // HasFuncStart1 returns true if the method "AudioRenderCapacity.start" exists. 3064 func (this AudioRenderCapacity) HasFuncStart1() bool { 3065 return js.True == bindings.HasFuncAudioRenderCapacityStart1( 3066 this.ref, 3067 ) 3068 } 3069 3070 // FuncStart1 returns the method "AudioRenderCapacity.start". 3071 func (this AudioRenderCapacity) FuncStart1() (fn js.Func[func()]) { 3072 bindings.FuncAudioRenderCapacityStart1( 3073 this.ref, js.Pointer(&fn), 3074 ) 3075 return 3076 } 3077 3078 // Start1 calls the method "AudioRenderCapacity.start". 3079 func (this AudioRenderCapacity) Start1() (ret js.Void) { 3080 bindings.CallAudioRenderCapacityStart1( 3081 this.ref, js.Pointer(&ret), 3082 ) 3083 3084 return 3085 } 3086 3087 // TryStart1 calls the method "AudioRenderCapacity.start" 3088 // in a try/catch block and returns (_, err, ok = false) when it went through 3089 // the catch clause. 3090 func (this AudioRenderCapacity) TryStart1() (ret js.Void, exception js.Any, ok bool) { 3091 ok = js.True == bindings.TryAudioRenderCapacityStart1( 3092 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3093 ) 3094 3095 return 3096 } 3097 3098 // HasFuncStop returns true if the method "AudioRenderCapacity.stop" exists. 3099 func (this AudioRenderCapacity) HasFuncStop() bool { 3100 return js.True == bindings.HasFuncAudioRenderCapacityStop( 3101 this.ref, 3102 ) 3103 } 3104 3105 // FuncStop returns the method "AudioRenderCapacity.stop". 3106 func (this AudioRenderCapacity) FuncStop() (fn js.Func[func()]) { 3107 bindings.FuncAudioRenderCapacityStop( 3108 this.ref, js.Pointer(&fn), 3109 ) 3110 return 3111 } 3112 3113 // Stop calls the method "AudioRenderCapacity.stop". 3114 func (this AudioRenderCapacity) Stop() (ret js.Void) { 3115 bindings.CallAudioRenderCapacityStop( 3116 this.ref, js.Pointer(&ret), 3117 ) 3118 3119 return 3120 } 3121 3122 // TryStop calls the method "AudioRenderCapacity.stop" 3123 // in a try/catch block and returns (_, err, ok = false) when it went through 3124 // the catch clause. 3125 func (this AudioRenderCapacity) TryStop() (ret js.Void, exception js.Any, ok bool) { 3126 ok = js.True == bindings.TryAudioRenderCapacityStop( 3127 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3128 ) 3129 3130 return 3131 } 3132 3133 func NewAudioContext(contextOptions AudioContextOptions) (ret AudioContext) { 3134 ret.ref = bindings.NewAudioContextByAudioContext( 3135 js.Pointer(&contextOptions)) 3136 return 3137 } 3138 3139 func NewAudioContextByAudioContext1() (ret AudioContext) { 3140 ret.ref = bindings.NewAudioContextByAudioContext1() 3141 return 3142 } 3143 3144 type AudioContext struct { 3145 BaseAudioContext 3146 } 3147 3148 func (this AudioContext) Once() AudioContext { 3149 this.ref.Once() 3150 return this 3151 } 3152 3153 func (this AudioContext) Ref() js.Ref { 3154 return this.BaseAudioContext.Ref() 3155 } 3156 3157 func (this AudioContext) FromRef(ref js.Ref) AudioContext { 3158 this.BaseAudioContext = this.BaseAudioContext.FromRef(ref) 3159 return this 3160 } 3161 3162 func (this AudioContext) Free() { 3163 this.ref.Free() 3164 } 3165 3166 // BaseLatency returns the value of property "AudioContext.baseLatency". 3167 // 3168 // It returns ok=false if there is no such property. 3169 func (this AudioContext) BaseLatency() (ret float64, ok bool) { 3170 ok = js.True == bindings.GetAudioContextBaseLatency( 3171 this.ref, js.Pointer(&ret), 3172 ) 3173 return 3174 } 3175 3176 // OutputLatency returns the value of property "AudioContext.outputLatency". 3177 // 3178 // It returns ok=false if there is no such property. 3179 func (this AudioContext) OutputLatency() (ret float64, ok bool) { 3180 ok = js.True == bindings.GetAudioContextOutputLatency( 3181 this.ref, js.Pointer(&ret), 3182 ) 3183 return 3184 } 3185 3186 // SinkId returns the value of property "AudioContext.sinkId". 3187 // 3188 // It returns ok=false if there is no such property. 3189 func (this AudioContext) SinkId() (ret OneOf_String_AudioSinkInfo, ok bool) { 3190 ok = js.True == bindings.GetAudioContextSinkId( 3191 this.ref, js.Pointer(&ret), 3192 ) 3193 return 3194 } 3195 3196 // RenderCapacity returns the value of property "AudioContext.renderCapacity". 3197 // 3198 // It returns ok=false if there is no such property. 3199 func (this AudioContext) RenderCapacity() (ret AudioRenderCapacity, ok bool) { 3200 ok = js.True == bindings.GetAudioContextRenderCapacity( 3201 this.ref, js.Pointer(&ret), 3202 ) 3203 return 3204 } 3205 3206 // HasFuncGetOutputTimestamp returns true if the method "AudioContext.getOutputTimestamp" exists. 3207 func (this AudioContext) HasFuncGetOutputTimestamp() bool { 3208 return js.True == bindings.HasFuncAudioContextGetOutputTimestamp( 3209 this.ref, 3210 ) 3211 } 3212 3213 // FuncGetOutputTimestamp returns the method "AudioContext.getOutputTimestamp". 3214 func (this AudioContext) FuncGetOutputTimestamp() (fn js.Func[func() AudioTimestamp]) { 3215 bindings.FuncAudioContextGetOutputTimestamp( 3216 this.ref, js.Pointer(&fn), 3217 ) 3218 return 3219 } 3220 3221 // GetOutputTimestamp calls the method "AudioContext.getOutputTimestamp". 3222 func (this AudioContext) GetOutputTimestamp() (ret AudioTimestamp) { 3223 bindings.CallAudioContextGetOutputTimestamp( 3224 this.ref, js.Pointer(&ret), 3225 ) 3226 3227 return 3228 } 3229 3230 // TryGetOutputTimestamp calls the method "AudioContext.getOutputTimestamp" 3231 // in a try/catch block and returns (_, err, ok = false) when it went through 3232 // the catch clause. 3233 func (this AudioContext) TryGetOutputTimestamp() (ret AudioTimestamp, exception js.Any, ok bool) { 3234 ok = js.True == bindings.TryAudioContextGetOutputTimestamp( 3235 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3236 ) 3237 3238 return 3239 } 3240 3241 // HasFuncResume returns true if the method "AudioContext.resume" exists. 3242 func (this AudioContext) HasFuncResume() bool { 3243 return js.True == bindings.HasFuncAudioContextResume( 3244 this.ref, 3245 ) 3246 } 3247 3248 // FuncResume returns the method "AudioContext.resume". 3249 func (this AudioContext) FuncResume() (fn js.Func[func() js.Promise[js.Void]]) { 3250 bindings.FuncAudioContextResume( 3251 this.ref, js.Pointer(&fn), 3252 ) 3253 return 3254 } 3255 3256 // Resume calls the method "AudioContext.resume". 3257 func (this AudioContext) Resume() (ret js.Promise[js.Void]) { 3258 bindings.CallAudioContextResume( 3259 this.ref, js.Pointer(&ret), 3260 ) 3261 3262 return 3263 } 3264 3265 // TryResume calls the method "AudioContext.resume" 3266 // in a try/catch block and returns (_, err, ok = false) when it went through 3267 // the catch clause. 3268 func (this AudioContext) TryResume() (ret js.Promise[js.Void], exception js.Any, ok bool) { 3269 ok = js.True == bindings.TryAudioContextResume( 3270 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3271 ) 3272 3273 return 3274 } 3275 3276 // HasFuncSuspend returns true if the method "AudioContext.suspend" exists. 3277 func (this AudioContext) HasFuncSuspend() bool { 3278 return js.True == bindings.HasFuncAudioContextSuspend( 3279 this.ref, 3280 ) 3281 } 3282 3283 // FuncSuspend returns the method "AudioContext.suspend". 3284 func (this AudioContext) FuncSuspend() (fn js.Func[func() js.Promise[js.Void]]) { 3285 bindings.FuncAudioContextSuspend( 3286 this.ref, js.Pointer(&fn), 3287 ) 3288 return 3289 } 3290 3291 // Suspend calls the method "AudioContext.suspend". 3292 func (this AudioContext) Suspend() (ret js.Promise[js.Void]) { 3293 bindings.CallAudioContextSuspend( 3294 this.ref, js.Pointer(&ret), 3295 ) 3296 3297 return 3298 } 3299 3300 // TrySuspend calls the method "AudioContext.suspend" 3301 // in a try/catch block and returns (_, err, ok = false) when it went through 3302 // the catch clause. 3303 func (this AudioContext) TrySuspend() (ret js.Promise[js.Void], exception js.Any, ok bool) { 3304 ok = js.True == bindings.TryAudioContextSuspend( 3305 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3306 ) 3307 3308 return 3309 } 3310 3311 // HasFuncClose returns true if the method "AudioContext.close" exists. 3312 func (this AudioContext) HasFuncClose() bool { 3313 return js.True == bindings.HasFuncAudioContextClose( 3314 this.ref, 3315 ) 3316 } 3317 3318 // FuncClose returns the method "AudioContext.close". 3319 func (this AudioContext) FuncClose() (fn js.Func[func() js.Promise[js.Void]]) { 3320 bindings.FuncAudioContextClose( 3321 this.ref, js.Pointer(&fn), 3322 ) 3323 return 3324 } 3325 3326 // Close calls the method "AudioContext.close". 3327 func (this AudioContext) Close() (ret js.Promise[js.Void]) { 3328 bindings.CallAudioContextClose( 3329 this.ref, js.Pointer(&ret), 3330 ) 3331 3332 return 3333 } 3334 3335 // TryClose calls the method "AudioContext.close" 3336 // in a try/catch block and returns (_, err, ok = false) when it went through 3337 // the catch clause. 3338 func (this AudioContext) TryClose() (ret js.Promise[js.Void], exception js.Any, ok bool) { 3339 ok = js.True == bindings.TryAudioContextClose( 3340 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3341 ) 3342 3343 return 3344 } 3345 3346 // HasFuncSetSinkId returns true if the method "AudioContext.setSinkId" exists. 3347 func (this AudioContext) HasFuncSetSinkId() bool { 3348 return js.True == bindings.HasFuncAudioContextSetSinkId( 3349 this.ref, 3350 ) 3351 } 3352 3353 // FuncSetSinkId returns the method "AudioContext.setSinkId". 3354 func (this AudioContext) FuncSetSinkId() (fn js.Func[func(sinkId OneOf_String_AudioSinkOptions) js.Promise[js.Void]]) { 3355 bindings.FuncAudioContextSetSinkId( 3356 this.ref, js.Pointer(&fn), 3357 ) 3358 return 3359 } 3360 3361 // SetSinkId calls the method "AudioContext.setSinkId". 3362 func (this AudioContext) SetSinkId(sinkId OneOf_String_AudioSinkOptions) (ret js.Promise[js.Void]) { 3363 bindings.CallAudioContextSetSinkId( 3364 this.ref, js.Pointer(&ret), 3365 sinkId.Ref(), 3366 ) 3367 3368 return 3369 } 3370 3371 // TrySetSinkId calls the method "AudioContext.setSinkId" 3372 // in a try/catch block and returns (_, err, ok = false) when it went through 3373 // the catch clause. 3374 func (this AudioContext) TrySetSinkId(sinkId OneOf_String_AudioSinkOptions) (ret js.Promise[js.Void], exception js.Any, ok bool) { 3375 ok = js.True == bindings.TryAudioContextSetSinkId( 3376 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3377 sinkId.Ref(), 3378 ) 3379 3380 return 3381 } 3382 3383 // HasFuncCreateMediaElementSource returns true if the method "AudioContext.createMediaElementSource" exists. 3384 func (this AudioContext) HasFuncCreateMediaElementSource() bool { 3385 return js.True == bindings.HasFuncAudioContextCreateMediaElementSource( 3386 this.ref, 3387 ) 3388 } 3389 3390 // FuncCreateMediaElementSource returns the method "AudioContext.createMediaElementSource". 3391 func (this AudioContext) FuncCreateMediaElementSource() (fn js.Func[func(mediaElement HTMLMediaElement) MediaElementAudioSourceNode]) { 3392 bindings.FuncAudioContextCreateMediaElementSource( 3393 this.ref, js.Pointer(&fn), 3394 ) 3395 return 3396 } 3397 3398 // CreateMediaElementSource calls the method "AudioContext.createMediaElementSource". 3399 func (this AudioContext) CreateMediaElementSource(mediaElement HTMLMediaElement) (ret MediaElementAudioSourceNode) { 3400 bindings.CallAudioContextCreateMediaElementSource( 3401 this.ref, js.Pointer(&ret), 3402 mediaElement.Ref(), 3403 ) 3404 3405 return 3406 } 3407 3408 // TryCreateMediaElementSource calls the method "AudioContext.createMediaElementSource" 3409 // in a try/catch block and returns (_, err, ok = false) when it went through 3410 // the catch clause. 3411 func (this AudioContext) TryCreateMediaElementSource(mediaElement HTMLMediaElement) (ret MediaElementAudioSourceNode, exception js.Any, ok bool) { 3412 ok = js.True == bindings.TryAudioContextCreateMediaElementSource( 3413 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3414 mediaElement.Ref(), 3415 ) 3416 3417 return 3418 } 3419 3420 // HasFuncCreateMediaStreamSource returns true if the method "AudioContext.createMediaStreamSource" exists. 3421 func (this AudioContext) HasFuncCreateMediaStreamSource() bool { 3422 return js.True == bindings.HasFuncAudioContextCreateMediaStreamSource( 3423 this.ref, 3424 ) 3425 } 3426 3427 // FuncCreateMediaStreamSource returns the method "AudioContext.createMediaStreamSource". 3428 func (this AudioContext) FuncCreateMediaStreamSource() (fn js.Func[func(mediaStream MediaStream) MediaStreamAudioSourceNode]) { 3429 bindings.FuncAudioContextCreateMediaStreamSource( 3430 this.ref, js.Pointer(&fn), 3431 ) 3432 return 3433 } 3434 3435 // CreateMediaStreamSource calls the method "AudioContext.createMediaStreamSource". 3436 func (this AudioContext) CreateMediaStreamSource(mediaStream MediaStream) (ret MediaStreamAudioSourceNode) { 3437 bindings.CallAudioContextCreateMediaStreamSource( 3438 this.ref, js.Pointer(&ret), 3439 mediaStream.Ref(), 3440 ) 3441 3442 return 3443 } 3444 3445 // TryCreateMediaStreamSource calls the method "AudioContext.createMediaStreamSource" 3446 // in a try/catch block and returns (_, err, ok = false) when it went through 3447 // the catch clause. 3448 func (this AudioContext) TryCreateMediaStreamSource(mediaStream MediaStream) (ret MediaStreamAudioSourceNode, exception js.Any, ok bool) { 3449 ok = js.True == bindings.TryAudioContextCreateMediaStreamSource( 3450 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3451 mediaStream.Ref(), 3452 ) 3453 3454 return 3455 } 3456 3457 // HasFuncCreateMediaStreamTrackSource returns true if the method "AudioContext.createMediaStreamTrackSource" exists. 3458 func (this AudioContext) HasFuncCreateMediaStreamTrackSource() bool { 3459 return js.True == bindings.HasFuncAudioContextCreateMediaStreamTrackSource( 3460 this.ref, 3461 ) 3462 } 3463 3464 // FuncCreateMediaStreamTrackSource returns the method "AudioContext.createMediaStreamTrackSource". 3465 func (this AudioContext) FuncCreateMediaStreamTrackSource() (fn js.Func[func(mediaStreamTrack MediaStreamTrack) MediaStreamTrackAudioSourceNode]) { 3466 bindings.FuncAudioContextCreateMediaStreamTrackSource( 3467 this.ref, js.Pointer(&fn), 3468 ) 3469 return 3470 } 3471 3472 // CreateMediaStreamTrackSource calls the method "AudioContext.createMediaStreamTrackSource". 3473 func (this AudioContext) CreateMediaStreamTrackSource(mediaStreamTrack MediaStreamTrack) (ret MediaStreamTrackAudioSourceNode) { 3474 bindings.CallAudioContextCreateMediaStreamTrackSource( 3475 this.ref, js.Pointer(&ret), 3476 mediaStreamTrack.Ref(), 3477 ) 3478 3479 return 3480 } 3481 3482 // TryCreateMediaStreamTrackSource calls the method "AudioContext.createMediaStreamTrackSource" 3483 // in a try/catch block and returns (_, err, ok = false) when it went through 3484 // the catch clause. 3485 func (this AudioContext) TryCreateMediaStreamTrackSource(mediaStreamTrack MediaStreamTrack) (ret MediaStreamTrackAudioSourceNode, exception js.Any, ok bool) { 3486 ok = js.True == bindings.TryAudioContextCreateMediaStreamTrackSource( 3487 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3488 mediaStreamTrack.Ref(), 3489 ) 3490 3491 return 3492 } 3493 3494 // HasFuncCreateMediaStreamDestination returns true if the method "AudioContext.createMediaStreamDestination" exists. 3495 func (this AudioContext) HasFuncCreateMediaStreamDestination() bool { 3496 return js.True == bindings.HasFuncAudioContextCreateMediaStreamDestination( 3497 this.ref, 3498 ) 3499 } 3500 3501 // FuncCreateMediaStreamDestination returns the method "AudioContext.createMediaStreamDestination". 3502 func (this AudioContext) FuncCreateMediaStreamDestination() (fn js.Func[func() MediaStreamAudioDestinationNode]) { 3503 bindings.FuncAudioContextCreateMediaStreamDestination( 3504 this.ref, js.Pointer(&fn), 3505 ) 3506 return 3507 } 3508 3509 // CreateMediaStreamDestination calls the method "AudioContext.createMediaStreamDestination". 3510 func (this AudioContext) CreateMediaStreamDestination() (ret MediaStreamAudioDestinationNode) { 3511 bindings.CallAudioContextCreateMediaStreamDestination( 3512 this.ref, js.Pointer(&ret), 3513 ) 3514 3515 return 3516 } 3517 3518 // TryCreateMediaStreamDestination calls the method "AudioContext.createMediaStreamDestination" 3519 // in a try/catch block and returns (_, err, ok = false) when it went through 3520 // the catch clause. 3521 func (this AudioContext) TryCreateMediaStreamDestination() (ret MediaStreamAudioDestinationNode, exception js.Any, ok bool) { 3522 ok = js.True == bindings.TryAudioContextCreateMediaStreamDestination( 3523 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3524 ) 3525 3526 return 3527 } 3528 3529 type AudioSampleFormat uint32 3530 3531 const ( 3532 _ AudioSampleFormat = iota 3533 3534 AudioSampleFormat_U8 3535 AudioSampleFormat_S16 3536 AudioSampleFormat_S32 3537 AudioSampleFormat_F32 3538 AudioSampleFormat_U8_PLANAR 3539 AudioSampleFormat_S16_PLANAR 3540 AudioSampleFormat_S32_PLANAR 3541 AudioSampleFormat_F32_PLANAR 3542 ) 3543 3544 func (AudioSampleFormat) FromRef(str js.Ref) AudioSampleFormat { 3545 return AudioSampleFormat(bindings.ConstOfAudioSampleFormat(str)) 3546 } 3547 3548 func (x AudioSampleFormat) String() (string, bool) { 3549 switch x { 3550 case AudioSampleFormat_U8: 3551 return "u8", true 3552 case AudioSampleFormat_S16: 3553 return "s16", true 3554 case AudioSampleFormat_S32: 3555 return "s32", true 3556 case AudioSampleFormat_F32: 3557 return "f32", true 3558 case AudioSampleFormat_U8_PLANAR: 3559 return "u8-planar", true 3560 case AudioSampleFormat_S16_PLANAR: 3561 return "s16-planar", true 3562 case AudioSampleFormat_S32_PLANAR: 3563 return "s32-planar", true 3564 case AudioSampleFormat_F32_PLANAR: 3565 return "f32-planar", true 3566 default: 3567 return "", false 3568 } 3569 } 3570 3571 type AudioDataInit struct { 3572 // Format is "AudioDataInit.format" 3573 // 3574 // Required 3575 Format AudioSampleFormat 3576 // SampleRate is "AudioDataInit.sampleRate" 3577 // 3578 // Required 3579 SampleRate float32 3580 // NumberOfFrames is "AudioDataInit.numberOfFrames" 3581 // 3582 // Required 3583 NumberOfFrames uint32 3584 // NumberOfChannels is "AudioDataInit.numberOfChannels" 3585 // 3586 // Required 3587 NumberOfChannels uint32 3588 // Timestamp is "AudioDataInit.timestamp" 3589 // 3590 // Required 3591 Timestamp int64 3592 // Data is "AudioDataInit.data" 3593 // 3594 // Required 3595 Data BufferSource 3596 // Transfer is "AudioDataInit.transfer" 3597 // 3598 // Optional, defaults to []. 3599 Transfer js.Array[js.ArrayBuffer] 3600 3601 FFI_USE bool 3602 } 3603 3604 // FromRef calls UpdateFrom and returns a AudioDataInit with all fields set. 3605 func (p AudioDataInit) FromRef(ref js.Ref) AudioDataInit { 3606 p.UpdateFrom(ref) 3607 return p 3608 } 3609 3610 // New creates a new AudioDataInit in the application heap. 3611 func (p AudioDataInit) New() js.Ref { 3612 return bindings.AudioDataInitJSLoad( 3613 js.Pointer(&p), js.True, 0, 3614 ) 3615 } 3616 3617 // UpdateFrom copies value of all fields of the heap object to p. 3618 func (p *AudioDataInit) UpdateFrom(ref js.Ref) { 3619 bindings.AudioDataInitJSStore( 3620 js.Pointer(p), ref, 3621 ) 3622 } 3623 3624 // Update writes all fields of the p to the heap object referenced by ref. 3625 func (p *AudioDataInit) Update(ref js.Ref) { 3626 bindings.AudioDataInitJSLoad( 3627 js.Pointer(p), js.False, ref, 3628 ) 3629 } 3630 3631 // FreeMembers frees fields with heap reference, if recursive is true 3632 // free all heap references reachable from p. 3633 func (p *AudioDataInit) FreeMembers(recursive bool) { 3634 js.Free( 3635 p.Data.Ref(), 3636 p.Transfer.Ref(), 3637 ) 3638 p.Data = p.Data.FromRef(js.Undefined) 3639 p.Transfer = p.Transfer.FromRef(js.Undefined) 3640 } 3641 3642 type AudioDataCopyToOptions struct { 3643 // PlaneIndex is "AudioDataCopyToOptions.planeIndex" 3644 // 3645 // Required 3646 PlaneIndex uint32 3647 // FrameOffset is "AudioDataCopyToOptions.frameOffset" 3648 // 3649 // Optional, defaults to 0. 3650 // 3651 // NOTE: FFI_USE_FrameOffset MUST be set to true to make this field effective. 3652 FrameOffset uint32 3653 // FrameCount is "AudioDataCopyToOptions.frameCount" 3654 // 3655 // Optional 3656 // 3657 // NOTE: FFI_USE_FrameCount MUST be set to true to make this field effective. 3658 FrameCount uint32 3659 // Format is "AudioDataCopyToOptions.format" 3660 // 3661 // Optional 3662 Format AudioSampleFormat 3663 3664 FFI_USE_FrameOffset bool // for FrameOffset. 3665 FFI_USE_FrameCount bool // for FrameCount. 3666 3667 FFI_USE bool 3668 } 3669 3670 // FromRef calls UpdateFrom and returns a AudioDataCopyToOptions with all fields set. 3671 func (p AudioDataCopyToOptions) FromRef(ref js.Ref) AudioDataCopyToOptions { 3672 p.UpdateFrom(ref) 3673 return p 3674 } 3675 3676 // New creates a new AudioDataCopyToOptions in the application heap. 3677 func (p AudioDataCopyToOptions) New() js.Ref { 3678 return bindings.AudioDataCopyToOptionsJSLoad( 3679 js.Pointer(&p), js.True, 0, 3680 ) 3681 } 3682 3683 // UpdateFrom copies value of all fields of the heap object to p. 3684 func (p *AudioDataCopyToOptions) UpdateFrom(ref js.Ref) { 3685 bindings.AudioDataCopyToOptionsJSStore( 3686 js.Pointer(p), ref, 3687 ) 3688 } 3689 3690 // Update writes all fields of the p to the heap object referenced by ref. 3691 func (p *AudioDataCopyToOptions) Update(ref js.Ref) { 3692 bindings.AudioDataCopyToOptionsJSLoad( 3693 js.Pointer(p), js.False, ref, 3694 ) 3695 } 3696 3697 // FreeMembers frees fields with heap reference, if recursive is true 3698 // free all heap references reachable from p. 3699 func (p *AudioDataCopyToOptions) FreeMembers(recursive bool) { 3700 } 3701 3702 func NewAudioData(init AudioDataInit) (ret AudioData) { 3703 ret.ref = bindings.NewAudioDataByAudioData( 3704 js.Pointer(&init)) 3705 return 3706 } 3707 3708 type AudioData struct { 3709 ref js.Ref 3710 } 3711 3712 func (this AudioData) Once() AudioData { 3713 this.ref.Once() 3714 return this 3715 } 3716 3717 func (this AudioData) Ref() js.Ref { 3718 return this.ref 3719 } 3720 3721 func (this AudioData) FromRef(ref js.Ref) AudioData { 3722 this.ref = ref 3723 return this 3724 } 3725 3726 func (this AudioData) Free() { 3727 this.ref.Free() 3728 } 3729 3730 // Format returns the value of property "AudioData.format". 3731 // 3732 // It returns ok=false if there is no such property. 3733 func (this AudioData) Format() (ret AudioSampleFormat, ok bool) { 3734 ok = js.True == bindings.GetAudioDataFormat( 3735 this.ref, js.Pointer(&ret), 3736 ) 3737 return 3738 } 3739 3740 // SampleRate returns the value of property "AudioData.sampleRate". 3741 // 3742 // It returns ok=false if there is no such property. 3743 func (this AudioData) SampleRate() (ret float32, ok bool) { 3744 ok = js.True == bindings.GetAudioDataSampleRate( 3745 this.ref, js.Pointer(&ret), 3746 ) 3747 return 3748 } 3749 3750 // NumberOfFrames returns the value of property "AudioData.numberOfFrames". 3751 // 3752 // It returns ok=false if there is no such property. 3753 func (this AudioData) NumberOfFrames() (ret uint32, ok bool) { 3754 ok = js.True == bindings.GetAudioDataNumberOfFrames( 3755 this.ref, js.Pointer(&ret), 3756 ) 3757 return 3758 } 3759 3760 // NumberOfChannels returns the value of property "AudioData.numberOfChannels". 3761 // 3762 // It returns ok=false if there is no such property. 3763 func (this AudioData) NumberOfChannels() (ret uint32, ok bool) { 3764 ok = js.True == bindings.GetAudioDataNumberOfChannels( 3765 this.ref, js.Pointer(&ret), 3766 ) 3767 return 3768 } 3769 3770 // Duration returns the value of property "AudioData.duration". 3771 // 3772 // It returns ok=false if there is no such property. 3773 func (this AudioData) Duration() (ret uint64, ok bool) { 3774 ok = js.True == bindings.GetAudioDataDuration( 3775 this.ref, js.Pointer(&ret), 3776 ) 3777 return 3778 } 3779 3780 // Timestamp returns the value of property "AudioData.timestamp". 3781 // 3782 // It returns ok=false if there is no such property. 3783 func (this AudioData) Timestamp() (ret int64, ok bool) { 3784 ok = js.True == bindings.GetAudioDataTimestamp( 3785 this.ref, js.Pointer(&ret), 3786 ) 3787 return 3788 } 3789 3790 // HasFuncAllocationSize returns true if the method "AudioData.allocationSize" exists. 3791 func (this AudioData) HasFuncAllocationSize() bool { 3792 return js.True == bindings.HasFuncAudioDataAllocationSize( 3793 this.ref, 3794 ) 3795 } 3796 3797 // FuncAllocationSize returns the method "AudioData.allocationSize". 3798 func (this AudioData) FuncAllocationSize() (fn js.Func[func(options AudioDataCopyToOptions) uint32]) { 3799 bindings.FuncAudioDataAllocationSize( 3800 this.ref, js.Pointer(&fn), 3801 ) 3802 return 3803 } 3804 3805 // AllocationSize calls the method "AudioData.allocationSize". 3806 func (this AudioData) AllocationSize(options AudioDataCopyToOptions) (ret uint32) { 3807 bindings.CallAudioDataAllocationSize( 3808 this.ref, js.Pointer(&ret), 3809 js.Pointer(&options), 3810 ) 3811 3812 return 3813 } 3814 3815 // TryAllocationSize calls the method "AudioData.allocationSize" 3816 // in a try/catch block and returns (_, err, ok = false) when it went through 3817 // the catch clause. 3818 func (this AudioData) TryAllocationSize(options AudioDataCopyToOptions) (ret uint32, exception js.Any, ok bool) { 3819 ok = js.True == bindings.TryAudioDataAllocationSize( 3820 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3821 js.Pointer(&options), 3822 ) 3823 3824 return 3825 } 3826 3827 // HasFuncCopyTo returns true if the method "AudioData.copyTo" exists. 3828 func (this AudioData) HasFuncCopyTo() bool { 3829 return js.True == bindings.HasFuncAudioDataCopyTo( 3830 this.ref, 3831 ) 3832 } 3833 3834 // FuncCopyTo returns the method "AudioData.copyTo". 3835 func (this AudioData) FuncCopyTo() (fn js.Func[func(destination AllowSharedBufferSource, options AudioDataCopyToOptions)]) { 3836 bindings.FuncAudioDataCopyTo( 3837 this.ref, js.Pointer(&fn), 3838 ) 3839 return 3840 } 3841 3842 // CopyTo calls the method "AudioData.copyTo". 3843 func (this AudioData) CopyTo(destination AllowSharedBufferSource, options AudioDataCopyToOptions) (ret js.Void) { 3844 bindings.CallAudioDataCopyTo( 3845 this.ref, js.Pointer(&ret), 3846 destination.Ref(), 3847 js.Pointer(&options), 3848 ) 3849 3850 return 3851 } 3852 3853 // TryCopyTo calls the method "AudioData.copyTo" 3854 // in a try/catch block and returns (_, err, ok = false) when it went through 3855 // the catch clause. 3856 func (this AudioData) TryCopyTo(destination AllowSharedBufferSource, options AudioDataCopyToOptions) (ret js.Void, exception js.Any, ok bool) { 3857 ok = js.True == bindings.TryAudioDataCopyTo( 3858 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3859 destination.Ref(), 3860 js.Pointer(&options), 3861 ) 3862 3863 return 3864 } 3865 3866 // HasFuncClone returns true if the method "AudioData.clone" exists. 3867 func (this AudioData) HasFuncClone() bool { 3868 return js.True == bindings.HasFuncAudioDataClone( 3869 this.ref, 3870 ) 3871 } 3872 3873 // FuncClone returns the method "AudioData.clone". 3874 func (this AudioData) FuncClone() (fn js.Func[func() AudioData]) { 3875 bindings.FuncAudioDataClone( 3876 this.ref, js.Pointer(&fn), 3877 ) 3878 return 3879 } 3880 3881 // Clone calls the method "AudioData.clone". 3882 func (this AudioData) Clone() (ret AudioData) { 3883 bindings.CallAudioDataClone( 3884 this.ref, js.Pointer(&ret), 3885 ) 3886 3887 return 3888 } 3889 3890 // TryClone calls the method "AudioData.clone" 3891 // in a try/catch block and returns (_, err, ok = false) when it went through 3892 // the catch clause. 3893 func (this AudioData) TryClone() (ret AudioData, exception js.Any, ok bool) { 3894 ok = js.True == bindings.TryAudioDataClone( 3895 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3896 ) 3897 3898 return 3899 } 3900 3901 // HasFuncClose returns true if the method "AudioData.close" exists. 3902 func (this AudioData) HasFuncClose() bool { 3903 return js.True == bindings.HasFuncAudioDataClose( 3904 this.ref, 3905 ) 3906 } 3907 3908 // FuncClose returns the method "AudioData.close". 3909 func (this AudioData) FuncClose() (fn js.Func[func()]) { 3910 bindings.FuncAudioDataClose( 3911 this.ref, js.Pointer(&fn), 3912 ) 3913 return 3914 } 3915 3916 // Close calls the method "AudioData.close". 3917 func (this AudioData) Close() (ret js.Void) { 3918 bindings.CallAudioDataClose( 3919 this.ref, js.Pointer(&ret), 3920 ) 3921 3922 return 3923 } 3924 3925 // TryClose calls the method "AudioData.close" 3926 // in a try/catch block and returns (_, err, ok = false) when it went through 3927 // the catch clause. 3928 func (this AudioData) TryClose() (ret js.Void, exception js.Any, ok bool) { 3929 ok = js.True == bindings.TryAudioDataClose( 3930 this.ref, js.Pointer(&ret), js.Pointer(&exception), 3931 ) 3932 3933 return 3934 } 3935 3936 type AudioDataOutputCallbackFunc func(this js.Ref, output AudioData) js.Ref 3937 3938 func (fn AudioDataOutputCallbackFunc) Register() js.Func[func(output AudioData)] { 3939 return js.RegisterCallback[func(output AudioData)]( 3940 fn, abi.FuncPCABIInternal(fn), 3941 ) 3942 } 3943 3944 func (fn AudioDataOutputCallbackFunc) DispatchCallback( 3945 targetPC uintptr, ctx *js.CallbackContext, 3946 ) { 3947 args := ctx.Args() 3948 if len(args) != 1+1 /* js this */ || 3949 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 3950 js.ThrowInvalidCallbackInvocation() 3951 } 3952 3953 if ctx.Return(fn( 3954 args[0], 3955 3956 AudioData{}.FromRef(args[0+1]), 3957 )) { 3958 return 3959 } 3960 3961 js.ThrowCallbackValueNotReturned() 3962 } 3963 3964 type AudioDataOutputCallback[T any] struct { 3965 Fn func(arg T, this js.Ref, output AudioData) js.Ref 3966 Arg T 3967 } 3968 3969 func (cb *AudioDataOutputCallback[T]) Register() js.Func[func(output AudioData)] { 3970 return js.RegisterCallback[func(output AudioData)]( 3971 cb, abi.FuncPCABIInternal(cb.Fn), 3972 ) 3973 } 3974 3975 func (cb *AudioDataOutputCallback[T]) DispatchCallback( 3976 targetPC uintptr, ctx *js.CallbackContext, 3977 ) { 3978 args := ctx.Args() 3979 if len(args) != 1+1 /* js this */ || 3980 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 3981 js.ThrowInvalidCallbackInvocation() 3982 } 3983 3984 if ctx.Return(cb.Fn( 3985 cb.Arg, 3986 args[0], 3987 3988 AudioData{}.FromRef(args[0+1]), 3989 )) { 3990 return 3991 } 3992 3993 js.ThrowCallbackValueNotReturned() 3994 } 3995 3996 type WebCodecsErrorCallbackFunc func(this js.Ref, err DOMException) js.Ref 3997 3998 func (fn WebCodecsErrorCallbackFunc) Register() js.Func[func(err DOMException)] { 3999 return js.RegisterCallback[func(err DOMException)]( 4000 fn, abi.FuncPCABIInternal(fn), 4001 ) 4002 } 4003 4004 func (fn WebCodecsErrorCallbackFunc) DispatchCallback( 4005 targetPC uintptr, ctx *js.CallbackContext, 4006 ) { 4007 args := ctx.Args() 4008 if len(args) != 1+1 /* js this */ || 4009 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 4010 js.ThrowInvalidCallbackInvocation() 4011 } 4012 4013 if ctx.Return(fn( 4014 args[0], 4015 4016 DOMException{}.FromRef(args[0+1]), 4017 )) { 4018 return 4019 } 4020 4021 js.ThrowCallbackValueNotReturned() 4022 } 4023 4024 type WebCodecsErrorCallback[T any] struct { 4025 Fn func(arg T, this js.Ref, err DOMException) js.Ref 4026 Arg T 4027 } 4028 4029 func (cb *WebCodecsErrorCallback[T]) Register() js.Func[func(err DOMException)] { 4030 return js.RegisterCallback[func(err DOMException)]( 4031 cb, abi.FuncPCABIInternal(cb.Fn), 4032 ) 4033 } 4034 4035 func (cb *WebCodecsErrorCallback[T]) DispatchCallback( 4036 targetPC uintptr, ctx *js.CallbackContext, 4037 ) { 4038 args := ctx.Args() 4039 if len(args) != 1+1 /* js this */ || 4040 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 4041 js.ThrowInvalidCallbackInvocation() 4042 } 4043 4044 if ctx.Return(cb.Fn( 4045 cb.Arg, 4046 args[0], 4047 4048 DOMException{}.FromRef(args[0+1]), 4049 )) { 4050 return 4051 } 4052 4053 js.ThrowCallbackValueNotReturned() 4054 } 4055 4056 type AudioDecoderInit struct { 4057 // Output is "AudioDecoderInit.output" 4058 // 4059 // Required 4060 Output js.Func[func(output AudioData)] 4061 // Error is "AudioDecoderInit.error" 4062 // 4063 // Required 4064 Error js.Func[func(err DOMException)] 4065 4066 FFI_USE bool 4067 } 4068 4069 // FromRef calls UpdateFrom and returns a AudioDecoderInit with all fields set. 4070 func (p AudioDecoderInit) FromRef(ref js.Ref) AudioDecoderInit { 4071 p.UpdateFrom(ref) 4072 return p 4073 } 4074 4075 // New creates a new AudioDecoderInit in the application heap. 4076 func (p AudioDecoderInit) New() js.Ref { 4077 return bindings.AudioDecoderInitJSLoad( 4078 js.Pointer(&p), js.True, 0, 4079 ) 4080 } 4081 4082 // UpdateFrom copies value of all fields of the heap object to p. 4083 func (p *AudioDecoderInit) UpdateFrom(ref js.Ref) { 4084 bindings.AudioDecoderInitJSStore( 4085 js.Pointer(p), ref, 4086 ) 4087 } 4088 4089 // Update writes all fields of the p to the heap object referenced by ref. 4090 func (p *AudioDecoderInit) Update(ref js.Ref) { 4091 bindings.AudioDecoderInitJSLoad( 4092 js.Pointer(p), js.False, ref, 4093 ) 4094 } 4095 4096 // FreeMembers frees fields with heap reference, if recursive is true 4097 // free all heap references reachable from p. 4098 func (p *AudioDecoderInit) FreeMembers(recursive bool) { 4099 js.Free( 4100 p.Output.Ref(), 4101 p.Error.Ref(), 4102 ) 4103 p.Output = p.Output.FromRef(js.Undefined) 4104 p.Error = p.Error.FromRef(js.Undefined) 4105 } 4106 4107 type AudioDecoderConfig struct { 4108 // Codec is "AudioDecoderConfig.codec" 4109 // 4110 // Required 4111 Codec js.String 4112 // SampleRate is "AudioDecoderConfig.sampleRate" 4113 // 4114 // Required 4115 SampleRate uint32 4116 // NumberOfChannels is "AudioDecoderConfig.numberOfChannels" 4117 // 4118 // Required 4119 NumberOfChannels uint32 4120 // Description is "AudioDecoderConfig.description" 4121 // 4122 // Optional 4123 Description BufferSource 4124 4125 FFI_USE bool 4126 } 4127 4128 // FromRef calls UpdateFrom and returns a AudioDecoderConfig with all fields set. 4129 func (p AudioDecoderConfig) FromRef(ref js.Ref) AudioDecoderConfig { 4130 p.UpdateFrom(ref) 4131 return p 4132 } 4133 4134 // New creates a new AudioDecoderConfig in the application heap. 4135 func (p AudioDecoderConfig) New() js.Ref { 4136 return bindings.AudioDecoderConfigJSLoad( 4137 js.Pointer(&p), js.True, 0, 4138 ) 4139 } 4140 4141 // UpdateFrom copies value of all fields of the heap object to p. 4142 func (p *AudioDecoderConfig) UpdateFrom(ref js.Ref) { 4143 bindings.AudioDecoderConfigJSStore( 4144 js.Pointer(p), ref, 4145 ) 4146 } 4147 4148 // Update writes all fields of the p to the heap object referenced by ref. 4149 func (p *AudioDecoderConfig) Update(ref js.Ref) { 4150 bindings.AudioDecoderConfigJSLoad( 4151 js.Pointer(p), js.False, ref, 4152 ) 4153 } 4154 4155 // FreeMembers frees fields with heap reference, if recursive is true 4156 // free all heap references reachable from p. 4157 func (p *AudioDecoderConfig) FreeMembers(recursive bool) { 4158 js.Free( 4159 p.Codec.Ref(), 4160 p.Description.Ref(), 4161 ) 4162 p.Codec = p.Codec.FromRef(js.Undefined) 4163 p.Description = p.Description.FromRef(js.Undefined) 4164 } 4165 4166 type EncodedAudioChunkType uint32 4167 4168 const ( 4169 _ EncodedAudioChunkType = iota 4170 4171 EncodedAudioChunkType_KEY 4172 EncodedAudioChunkType_DELTA 4173 ) 4174 4175 func (EncodedAudioChunkType) FromRef(str js.Ref) EncodedAudioChunkType { 4176 return EncodedAudioChunkType(bindings.ConstOfEncodedAudioChunkType(str)) 4177 } 4178 4179 func (x EncodedAudioChunkType) String() (string, bool) { 4180 switch x { 4181 case EncodedAudioChunkType_KEY: 4182 return "key", true 4183 case EncodedAudioChunkType_DELTA: 4184 return "delta", true 4185 default: 4186 return "", false 4187 } 4188 } 4189 4190 type EncodedAudioChunkInit struct { 4191 // Type is "EncodedAudioChunkInit.type" 4192 // 4193 // Required 4194 Type EncodedAudioChunkType 4195 // Timestamp is "EncodedAudioChunkInit.timestamp" 4196 // 4197 // Required 4198 Timestamp int64 4199 // Duration is "EncodedAudioChunkInit.duration" 4200 // 4201 // Optional 4202 // 4203 // NOTE: FFI_USE_Duration MUST be set to true to make this field effective. 4204 Duration uint64 4205 // Data is "EncodedAudioChunkInit.data" 4206 // 4207 // Required 4208 Data BufferSource 4209 4210 FFI_USE_Duration bool // for Duration. 4211 4212 FFI_USE bool 4213 } 4214 4215 // FromRef calls UpdateFrom and returns a EncodedAudioChunkInit with all fields set. 4216 func (p EncodedAudioChunkInit) FromRef(ref js.Ref) EncodedAudioChunkInit { 4217 p.UpdateFrom(ref) 4218 return p 4219 } 4220 4221 // New creates a new EncodedAudioChunkInit in the application heap. 4222 func (p EncodedAudioChunkInit) New() js.Ref { 4223 return bindings.EncodedAudioChunkInitJSLoad( 4224 js.Pointer(&p), js.True, 0, 4225 ) 4226 } 4227 4228 // UpdateFrom copies value of all fields of the heap object to p. 4229 func (p *EncodedAudioChunkInit) UpdateFrom(ref js.Ref) { 4230 bindings.EncodedAudioChunkInitJSStore( 4231 js.Pointer(p), ref, 4232 ) 4233 } 4234 4235 // Update writes all fields of the p to the heap object referenced by ref. 4236 func (p *EncodedAudioChunkInit) Update(ref js.Ref) { 4237 bindings.EncodedAudioChunkInitJSLoad( 4238 js.Pointer(p), js.False, ref, 4239 ) 4240 } 4241 4242 // FreeMembers frees fields with heap reference, if recursive is true 4243 // free all heap references reachable from p. 4244 func (p *EncodedAudioChunkInit) FreeMembers(recursive bool) { 4245 js.Free( 4246 p.Data.Ref(), 4247 ) 4248 p.Data = p.Data.FromRef(js.Undefined) 4249 } 4250 4251 func NewEncodedAudioChunk(init EncodedAudioChunkInit) (ret EncodedAudioChunk) { 4252 ret.ref = bindings.NewEncodedAudioChunkByEncodedAudioChunk( 4253 js.Pointer(&init)) 4254 return 4255 } 4256 4257 type EncodedAudioChunk struct { 4258 ref js.Ref 4259 } 4260 4261 func (this EncodedAudioChunk) Once() EncodedAudioChunk { 4262 this.ref.Once() 4263 return this 4264 } 4265 4266 func (this EncodedAudioChunk) Ref() js.Ref { 4267 return this.ref 4268 } 4269 4270 func (this EncodedAudioChunk) FromRef(ref js.Ref) EncodedAudioChunk { 4271 this.ref = ref 4272 return this 4273 } 4274 4275 func (this EncodedAudioChunk) Free() { 4276 this.ref.Free() 4277 } 4278 4279 // Type returns the value of property "EncodedAudioChunk.type". 4280 // 4281 // It returns ok=false if there is no such property. 4282 func (this EncodedAudioChunk) Type() (ret EncodedAudioChunkType, ok bool) { 4283 ok = js.True == bindings.GetEncodedAudioChunkType( 4284 this.ref, js.Pointer(&ret), 4285 ) 4286 return 4287 } 4288 4289 // Timestamp returns the value of property "EncodedAudioChunk.timestamp". 4290 // 4291 // It returns ok=false if there is no such property. 4292 func (this EncodedAudioChunk) Timestamp() (ret int64, ok bool) { 4293 ok = js.True == bindings.GetEncodedAudioChunkTimestamp( 4294 this.ref, js.Pointer(&ret), 4295 ) 4296 return 4297 } 4298 4299 // Duration returns the value of property "EncodedAudioChunk.duration". 4300 // 4301 // It returns ok=false if there is no such property. 4302 func (this EncodedAudioChunk) Duration() (ret uint64, ok bool) { 4303 ok = js.True == bindings.GetEncodedAudioChunkDuration( 4304 this.ref, js.Pointer(&ret), 4305 ) 4306 return 4307 } 4308 4309 // ByteLength returns the value of property "EncodedAudioChunk.byteLength". 4310 // 4311 // It returns ok=false if there is no such property. 4312 func (this EncodedAudioChunk) ByteLength() (ret uint32, ok bool) { 4313 ok = js.True == bindings.GetEncodedAudioChunkByteLength( 4314 this.ref, js.Pointer(&ret), 4315 ) 4316 return 4317 } 4318 4319 // HasFuncCopyTo returns true if the method "EncodedAudioChunk.copyTo" exists. 4320 func (this EncodedAudioChunk) HasFuncCopyTo() bool { 4321 return js.True == bindings.HasFuncEncodedAudioChunkCopyTo( 4322 this.ref, 4323 ) 4324 } 4325 4326 // FuncCopyTo returns the method "EncodedAudioChunk.copyTo". 4327 func (this EncodedAudioChunk) FuncCopyTo() (fn js.Func[func(destination AllowSharedBufferSource)]) { 4328 bindings.FuncEncodedAudioChunkCopyTo( 4329 this.ref, js.Pointer(&fn), 4330 ) 4331 return 4332 } 4333 4334 // CopyTo calls the method "EncodedAudioChunk.copyTo". 4335 func (this EncodedAudioChunk) CopyTo(destination AllowSharedBufferSource) (ret js.Void) { 4336 bindings.CallEncodedAudioChunkCopyTo( 4337 this.ref, js.Pointer(&ret), 4338 destination.Ref(), 4339 ) 4340 4341 return 4342 } 4343 4344 // TryCopyTo calls the method "EncodedAudioChunk.copyTo" 4345 // in a try/catch block and returns (_, err, ok = false) when it went through 4346 // the catch clause. 4347 func (this EncodedAudioChunk) TryCopyTo(destination AllowSharedBufferSource) (ret js.Void, exception js.Any, ok bool) { 4348 ok = js.True == bindings.TryEncodedAudioChunkCopyTo( 4349 this.ref, js.Pointer(&ret), js.Pointer(&exception), 4350 destination.Ref(), 4351 ) 4352 4353 return 4354 } 4355 4356 type AudioDecoderSupport struct { 4357 // Supported is "AudioDecoderSupport.supported" 4358 // 4359 // Optional 4360 // 4361 // NOTE: FFI_USE_Supported MUST be set to true to make this field effective. 4362 Supported bool 4363 // Config is "AudioDecoderSupport.config" 4364 // 4365 // Optional 4366 // 4367 // NOTE: Config.FFI_USE MUST be set to true to get Config used. 4368 Config AudioDecoderConfig 4369 4370 FFI_USE_Supported bool // for Supported. 4371 4372 FFI_USE bool 4373 } 4374 4375 // FromRef calls UpdateFrom and returns a AudioDecoderSupport with all fields set. 4376 func (p AudioDecoderSupport) FromRef(ref js.Ref) AudioDecoderSupport { 4377 p.UpdateFrom(ref) 4378 return p 4379 } 4380 4381 // New creates a new AudioDecoderSupport in the application heap. 4382 func (p AudioDecoderSupport) New() js.Ref { 4383 return bindings.AudioDecoderSupportJSLoad( 4384 js.Pointer(&p), js.True, 0, 4385 ) 4386 } 4387 4388 // UpdateFrom copies value of all fields of the heap object to p. 4389 func (p *AudioDecoderSupport) UpdateFrom(ref js.Ref) { 4390 bindings.AudioDecoderSupportJSStore( 4391 js.Pointer(p), ref, 4392 ) 4393 } 4394 4395 // Update writes all fields of the p to the heap object referenced by ref. 4396 func (p *AudioDecoderSupport) Update(ref js.Ref) { 4397 bindings.AudioDecoderSupportJSLoad( 4398 js.Pointer(p), js.False, ref, 4399 ) 4400 } 4401 4402 // FreeMembers frees fields with heap reference, if recursive is true 4403 // free all heap references reachable from p. 4404 func (p *AudioDecoderSupport) FreeMembers(recursive bool) { 4405 if recursive { 4406 p.Config.FreeMembers(true) 4407 } 4408 } 4409 4410 type CodecState uint32 4411 4412 const ( 4413 _ CodecState = iota 4414 4415 CodecState_UNCONFIGURED 4416 CodecState_CONFIGURED 4417 CodecState_CLOSED 4418 ) 4419 4420 func (CodecState) FromRef(str js.Ref) CodecState { 4421 return CodecState(bindings.ConstOfCodecState(str)) 4422 } 4423 4424 func (x CodecState) String() (string, bool) { 4425 switch x { 4426 case CodecState_UNCONFIGURED: 4427 return "unconfigured", true 4428 case CodecState_CONFIGURED: 4429 return "configured", true 4430 case CodecState_CLOSED: 4431 return "closed", true 4432 default: 4433 return "", false 4434 } 4435 } 4436 4437 func NewAudioDecoder(init AudioDecoderInit) (ret AudioDecoder) { 4438 ret.ref = bindings.NewAudioDecoderByAudioDecoder( 4439 js.Pointer(&init)) 4440 return 4441 } 4442 4443 type AudioDecoder struct { 4444 EventTarget 4445 } 4446 4447 func (this AudioDecoder) Once() AudioDecoder { 4448 this.ref.Once() 4449 return this 4450 } 4451 4452 func (this AudioDecoder) Ref() js.Ref { 4453 return this.EventTarget.Ref() 4454 } 4455 4456 func (this AudioDecoder) FromRef(ref js.Ref) AudioDecoder { 4457 this.EventTarget = this.EventTarget.FromRef(ref) 4458 return this 4459 } 4460 4461 func (this AudioDecoder) Free() { 4462 this.ref.Free() 4463 } 4464 4465 // State returns the value of property "AudioDecoder.state". 4466 // 4467 // It returns ok=false if there is no such property. 4468 func (this AudioDecoder) State() (ret CodecState, ok bool) { 4469 ok = js.True == bindings.GetAudioDecoderState( 4470 this.ref, js.Pointer(&ret), 4471 ) 4472 return 4473 } 4474 4475 // DecodeQueueSize returns the value of property "AudioDecoder.decodeQueueSize". 4476 // 4477 // It returns ok=false if there is no such property. 4478 func (this AudioDecoder) DecodeQueueSize() (ret uint32, ok bool) { 4479 ok = js.True == bindings.GetAudioDecoderDecodeQueueSize( 4480 this.ref, js.Pointer(&ret), 4481 ) 4482 return 4483 } 4484 4485 // HasFuncConfigure returns true if the method "AudioDecoder.configure" exists. 4486 func (this AudioDecoder) HasFuncConfigure() bool { 4487 return js.True == bindings.HasFuncAudioDecoderConfigure( 4488 this.ref, 4489 ) 4490 } 4491 4492 // FuncConfigure returns the method "AudioDecoder.configure". 4493 func (this AudioDecoder) FuncConfigure() (fn js.Func[func(config AudioDecoderConfig)]) { 4494 bindings.FuncAudioDecoderConfigure( 4495 this.ref, js.Pointer(&fn), 4496 ) 4497 return 4498 } 4499 4500 // Configure calls the method "AudioDecoder.configure". 4501 func (this AudioDecoder) Configure(config AudioDecoderConfig) (ret js.Void) { 4502 bindings.CallAudioDecoderConfigure( 4503 this.ref, js.Pointer(&ret), 4504 js.Pointer(&config), 4505 ) 4506 4507 return 4508 } 4509 4510 // TryConfigure calls the method "AudioDecoder.configure" 4511 // in a try/catch block and returns (_, err, ok = false) when it went through 4512 // the catch clause. 4513 func (this AudioDecoder) TryConfigure(config AudioDecoderConfig) (ret js.Void, exception js.Any, ok bool) { 4514 ok = js.True == bindings.TryAudioDecoderConfigure( 4515 this.ref, js.Pointer(&ret), js.Pointer(&exception), 4516 js.Pointer(&config), 4517 ) 4518 4519 return 4520 } 4521 4522 // HasFuncDecode returns true if the method "AudioDecoder.decode" exists. 4523 func (this AudioDecoder) HasFuncDecode() bool { 4524 return js.True == bindings.HasFuncAudioDecoderDecode( 4525 this.ref, 4526 ) 4527 } 4528 4529 // FuncDecode returns the method "AudioDecoder.decode". 4530 func (this AudioDecoder) FuncDecode() (fn js.Func[func(chunk EncodedAudioChunk)]) { 4531 bindings.FuncAudioDecoderDecode( 4532 this.ref, js.Pointer(&fn), 4533 ) 4534 return 4535 } 4536 4537 // Decode calls the method "AudioDecoder.decode". 4538 func (this AudioDecoder) Decode(chunk EncodedAudioChunk) (ret js.Void) { 4539 bindings.CallAudioDecoderDecode( 4540 this.ref, js.Pointer(&ret), 4541 chunk.Ref(), 4542 ) 4543 4544 return 4545 } 4546 4547 // TryDecode calls the method "AudioDecoder.decode" 4548 // in a try/catch block and returns (_, err, ok = false) when it went through 4549 // the catch clause. 4550 func (this AudioDecoder) TryDecode(chunk EncodedAudioChunk) (ret js.Void, exception js.Any, ok bool) { 4551 ok = js.True == bindings.TryAudioDecoderDecode( 4552 this.ref, js.Pointer(&ret), js.Pointer(&exception), 4553 chunk.Ref(), 4554 ) 4555 4556 return 4557 } 4558 4559 // HasFuncFlush returns true if the method "AudioDecoder.flush" exists. 4560 func (this AudioDecoder) HasFuncFlush() bool { 4561 return js.True == bindings.HasFuncAudioDecoderFlush( 4562 this.ref, 4563 ) 4564 } 4565 4566 // FuncFlush returns the method "AudioDecoder.flush". 4567 func (this AudioDecoder) FuncFlush() (fn js.Func[func() js.Promise[js.Void]]) { 4568 bindings.FuncAudioDecoderFlush( 4569 this.ref, js.Pointer(&fn), 4570 ) 4571 return 4572 } 4573 4574 // Flush calls the method "AudioDecoder.flush". 4575 func (this AudioDecoder) Flush() (ret js.Promise[js.Void]) { 4576 bindings.CallAudioDecoderFlush( 4577 this.ref, js.Pointer(&ret), 4578 ) 4579 4580 return 4581 } 4582 4583 // TryFlush calls the method "AudioDecoder.flush" 4584 // in a try/catch block and returns (_, err, ok = false) when it went through 4585 // the catch clause. 4586 func (this AudioDecoder) TryFlush() (ret js.Promise[js.Void], exception js.Any, ok bool) { 4587 ok = js.True == bindings.TryAudioDecoderFlush( 4588 this.ref, js.Pointer(&ret), js.Pointer(&exception), 4589 ) 4590 4591 return 4592 } 4593 4594 // HasFuncReset returns true if the method "AudioDecoder.reset" exists. 4595 func (this AudioDecoder) HasFuncReset() bool { 4596 return js.True == bindings.HasFuncAudioDecoderReset( 4597 this.ref, 4598 ) 4599 } 4600 4601 // FuncReset returns the method "AudioDecoder.reset". 4602 func (this AudioDecoder) FuncReset() (fn js.Func[func()]) { 4603 bindings.FuncAudioDecoderReset( 4604 this.ref, js.Pointer(&fn), 4605 ) 4606 return 4607 } 4608 4609 // Reset calls the method "AudioDecoder.reset". 4610 func (this AudioDecoder) Reset() (ret js.Void) { 4611 bindings.CallAudioDecoderReset( 4612 this.ref, js.Pointer(&ret), 4613 ) 4614 4615 return 4616 } 4617 4618 // TryReset calls the method "AudioDecoder.reset" 4619 // in a try/catch block and returns (_, err, ok = false) when it went through 4620 // the catch clause. 4621 func (this AudioDecoder) TryReset() (ret js.Void, exception js.Any, ok bool) { 4622 ok = js.True == bindings.TryAudioDecoderReset( 4623 this.ref, js.Pointer(&ret), js.Pointer(&exception), 4624 ) 4625 4626 return 4627 } 4628 4629 // HasFuncClose returns true if the method "AudioDecoder.close" exists. 4630 func (this AudioDecoder) HasFuncClose() bool { 4631 return js.True == bindings.HasFuncAudioDecoderClose( 4632 this.ref, 4633 ) 4634 } 4635 4636 // FuncClose returns the method "AudioDecoder.close". 4637 func (this AudioDecoder) FuncClose() (fn js.Func[func()]) { 4638 bindings.FuncAudioDecoderClose( 4639 this.ref, js.Pointer(&fn), 4640 ) 4641 return 4642 } 4643 4644 // Close calls the method "AudioDecoder.close". 4645 func (this AudioDecoder) Close() (ret js.Void) { 4646 bindings.CallAudioDecoderClose( 4647 this.ref, js.Pointer(&ret), 4648 ) 4649 4650 return 4651 } 4652 4653 // TryClose calls the method "AudioDecoder.close" 4654 // in a try/catch block and returns (_, err, ok = false) when it went through 4655 // the catch clause. 4656 func (this AudioDecoder) TryClose() (ret js.Void, exception js.Any, ok bool) { 4657 ok = js.True == bindings.TryAudioDecoderClose( 4658 this.ref, js.Pointer(&ret), js.Pointer(&exception), 4659 ) 4660 4661 return 4662 } 4663 4664 // HasFuncIsConfigSupported returns true if the static method "AudioDecoder.isConfigSupported" exists. 4665 func (this AudioDecoder) HasFuncIsConfigSupported() bool { 4666 return js.True == bindings.HasFuncAudioDecoderIsConfigSupported( 4667 this.ref, 4668 ) 4669 } 4670 4671 // FuncIsConfigSupported returns the static method "AudioDecoder.isConfigSupported". 4672 func (this AudioDecoder) FuncIsConfigSupported() (fn js.Func[func(config AudioDecoderConfig) js.Promise[AudioDecoderSupport]]) { 4673 bindings.FuncAudioDecoderIsConfigSupported( 4674 this.ref, js.Pointer(&fn), 4675 ) 4676 return 4677 } 4678 4679 // IsConfigSupported calls the static method "AudioDecoder.isConfigSupported". 4680 func (this AudioDecoder) IsConfigSupported(config AudioDecoderConfig) (ret js.Promise[AudioDecoderSupport]) { 4681 bindings.CallAudioDecoderIsConfigSupported( 4682 this.ref, js.Pointer(&ret), 4683 js.Pointer(&config), 4684 ) 4685 4686 return 4687 } 4688 4689 // TryIsConfigSupported calls the static method "AudioDecoder.isConfigSupported" 4690 // in a try/catch block and returns (_, err, ok = false) when it went through 4691 // the catch clause. 4692 func (this AudioDecoder) TryIsConfigSupported(config AudioDecoderConfig) (ret js.Promise[AudioDecoderSupport], exception js.Any, ok bool) { 4693 ok = js.True == bindings.TryAudioDecoderIsConfigSupported( 4694 this.ref, js.Pointer(&ret), js.Pointer(&exception), 4695 js.Pointer(&config), 4696 ) 4697 4698 return 4699 } 4700 4701 type EncodedAudioChunkOutputCallbackFunc func(this js.Ref, output EncodedAudioChunk, metadata *EncodedAudioChunkMetadata) js.Ref 4702 4703 func (fn EncodedAudioChunkOutputCallbackFunc) Register() js.Func[func(output EncodedAudioChunk, metadata *EncodedAudioChunkMetadata)] { 4704 return js.RegisterCallback[func(output EncodedAudioChunk, metadata *EncodedAudioChunkMetadata)]( 4705 fn, abi.FuncPCABIInternal(fn), 4706 ) 4707 } 4708 4709 func (fn EncodedAudioChunkOutputCallbackFunc) DispatchCallback( 4710 targetPC uintptr, ctx *js.CallbackContext, 4711 ) { 4712 args := ctx.Args() 4713 if len(args) != 2+1 /* js this */ || 4714 targetPC != uintptr(abi.FuncPCABIInternal(fn)) { 4715 js.ThrowInvalidCallbackInvocation() 4716 } 4717 var arg1 EncodedAudioChunkMetadata 4718 arg1.UpdateFrom(args[1+1]) 4719 defer arg1.FreeMembers(true) 4720 4721 if ctx.Return(fn( 4722 args[0], 4723 4724 EncodedAudioChunk{}.FromRef(args[0+1]), 4725 mark.NoEscape(&arg1), 4726 )) { 4727 return 4728 } 4729 4730 js.ThrowCallbackValueNotReturned() 4731 } 4732 4733 type EncodedAudioChunkOutputCallback[T any] struct { 4734 Fn func(arg T, this js.Ref, output EncodedAudioChunk, metadata *EncodedAudioChunkMetadata) js.Ref 4735 Arg T 4736 } 4737 4738 func (cb *EncodedAudioChunkOutputCallback[T]) Register() js.Func[func(output EncodedAudioChunk, metadata *EncodedAudioChunkMetadata)] { 4739 return js.RegisterCallback[func(output EncodedAudioChunk, metadata *EncodedAudioChunkMetadata)]( 4740 cb, abi.FuncPCABIInternal(cb.Fn), 4741 ) 4742 } 4743 4744 func (cb *EncodedAudioChunkOutputCallback[T]) DispatchCallback( 4745 targetPC uintptr, ctx *js.CallbackContext, 4746 ) { 4747 args := ctx.Args() 4748 if len(args) != 2+1 /* js this */ || 4749 targetPC != uintptr(abi.FuncPCABIInternal(cb.Fn)) { 4750 js.ThrowInvalidCallbackInvocation() 4751 } 4752 var arg1 EncodedAudioChunkMetadata 4753 arg1.UpdateFrom(args[1+1]) 4754 defer arg1.FreeMembers(true) 4755 4756 if ctx.Return(cb.Fn( 4757 cb.Arg, 4758 args[0], 4759 4760 EncodedAudioChunk{}.FromRef(args[0+1]), 4761 mark.NoEscape(&arg1), 4762 )) { 4763 return 4764 } 4765 4766 js.ThrowCallbackValueNotReturned() 4767 } 4768 4769 type EncodedAudioChunkMetadata struct { 4770 // DecoderConfig is "EncodedAudioChunkMetadata.decoderConfig" 4771 // 4772 // Optional 4773 // 4774 // NOTE: DecoderConfig.FFI_USE MUST be set to true to get DecoderConfig used. 4775 DecoderConfig AudioDecoderConfig 4776 4777 FFI_USE bool 4778 } 4779 4780 // FromRef calls UpdateFrom and returns a EncodedAudioChunkMetadata with all fields set. 4781 func (p EncodedAudioChunkMetadata) FromRef(ref js.Ref) EncodedAudioChunkMetadata { 4782 p.UpdateFrom(ref) 4783 return p 4784 } 4785 4786 // New creates a new EncodedAudioChunkMetadata in the application heap. 4787 func (p EncodedAudioChunkMetadata) New() js.Ref { 4788 return bindings.EncodedAudioChunkMetadataJSLoad( 4789 js.Pointer(&p), js.True, 0, 4790 ) 4791 } 4792 4793 // UpdateFrom copies value of all fields of the heap object to p. 4794 func (p *EncodedAudioChunkMetadata) UpdateFrom(ref js.Ref) { 4795 bindings.EncodedAudioChunkMetadataJSStore( 4796 js.Pointer(p), ref, 4797 ) 4798 } 4799 4800 // Update writes all fields of the p to the heap object referenced by ref. 4801 func (p *EncodedAudioChunkMetadata) Update(ref js.Ref) { 4802 bindings.EncodedAudioChunkMetadataJSLoad( 4803 js.Pointer(p), js.False, ref, 4804 ) 4805 } 4806 4807 // FreeMembers frees fields with heap reference, if recursive is true 4808 // free all heap references reachable from p. 4809 func (p *EncodedAudioChunkMetadata) FreeMembers(recursive bool) { 4810 if recursive { 4811 p.DecoderConfig.FreeMembers(true) 4812 } 4813 }