VideoTextureWorker constructor

VideoTextureWorker([
  1. ImageElement? video,
  2. int? mapping,
  3. int? wrapS,
  4. int? wrapT,
  5. int? magFilter,
  6. int? minFilter,
  7. int? format,
  8. int? type,
  9. int? anisotropy,
])

video - The video element to use as the texture.

mapping - How the image is applied to the object. An object type of page:Textures UVMapping. See page:Textures mapping constants for other choices.

wrapS - The default is page:Textures ClampToEdgeWrapping. See page:Textures wrap mode constants for other choices.

wrapT - The default is page:Textures ClampToEdgeWrapping. See page:Textures wrap mode constants for other choices.

magFilter - How the texture is sampled when a texel covers more than one pixel. The default is page:Textures LinearFilter. See page:Textures magnification filter constants for other choices.

minFilter - How the texture is sampled when a texel covers less than one pixel. The default is page:Textures LinearFilter. See page:Textures minification filter constants for other choices.

format - The default is page:Textures RGBAFormat. See page:Textures format constants for other choices.

type - Default is page:Textures UnsignedByteType. See page:Textures type constants for other choices.

anisotropy - The number of samples taken along the axis through the pixel that has the highest density of texels. By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used. Use renderer.getMaxAnisotropy to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.

Implementation

VideoTextureWorker([
  ImageElement? video,
  int? mapping,
  int? wrapS,
  int? wrapT,
  int? magFilter,
  int? minFilter,
  int? format,
  int? type,
  int? anisotropy
]):super(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) {
  MediaKit.ensureInitialized();
  isVideoTexture = true;
  this.minFilter = minFilter ?? LinearFilter;
  this.magFilter = magFilter ?? LinearFilter;

  generateMipmaps = false;

  _player = Player();
  _controller = VideoController(_player!,configuration: VideoControllerConfiguration(
    width: image!.height.toInt(),
    height: image.width.toInt()
  ));
  _player!.open(Media(_convert(image.src!))).then((_){
    if((image.url as VideoTextureOptions).loop){
      _player!.setPlaylistMode(PlaylistMode.single);
      _isPlaying = true;
    }
  });
}