Video

TsgcHTMLComponent_Video — renderiza un reproductor de vídeo o audio HTML5 adaptable, más un ayudante para incrustar YouTube, en Delphi, C++ Builder y .NET.

TsgcHTMLComponent_Video

Un reproductor multimedia HTML5 que emite un elemento <video> o <audio>. Establece la fuente y las opciones de reproducción, y luego lee la propiedad HTML.

Clase de componente

TsgcHTMLComponent_Video

Renderiza

Multimedia HTML5 <video> / <audio>

Lenguajes

Delphi, C++ Builder, .NET

Créalo, establece la fuente, renderízalo

Asigna Src y MediaType, activa Controls, Autoplay y Responsive, y luego lee HTML — o usa los ayudantes estáticos Build y BuildYouTube.

uses
  sgcHTML_Component_Video;

var
  oVid: TsgcHTMLComponent_Video;
begin
  oVid := TsgcHTMLComponent_Video.Create(nil);
  try
    oVid.Src := '/media/intro.mp4';
    oVid.MediaType := mtVideo;
    oVid.Controls := True;
    oVid.Poster := '/media/intro.jpg';
    oVid.Responsive := True;

    WebModule.Response := oVid.HTML;   // <video> element
  finally
    oVid.Free;
  end;
end;

// Or in a single line with the static helpers:
Result := TsgcHTMLComponent_Video.Build('/media/intro.mp4', mtVideo, True);
Result := TsgcHTMLComponent_Video.BuildYouTube('dQw4w9WgXcQ', '100%', '400');
// includes: sgcHTML_Component_Video.hpp

TsgcHTMLComponent_Video *oVid = new TsgcHTMLComponent_Video(NULL);
try
{
  oVid->Src = "/media/intro.mp4";
  oVid->MediaType = mtVideo;
  oVid->Controls = true;
  oVid->Poster = "/media/intro.jpg";
  oVid->Responsive = true;

  String html = oVid->HTML;   // <video> element
}
__finally
{
  delete oVid;
}

// Or in a single line with the static helpers:
String html = TsgcHTMLComponent_Video::Build("/media/intro.mp4", mtVideo, true);
String yt = TsgcHTMLComponent_Video::BuildYouTube("dQw4w9WgXcQ", "100%", "400");
using esegece.sgcWebSockets;

var video = new TsgcHTMLComponent_Video();
video.Src = "/media/intro.mp4";
video.MediaType = TsgcHTMLMediaType.mtVideo;
video.Controls = true;
video.Poster = "/media/intro.jpg";
video.Responsive = true;

string html = video.HTML;   // <video> element

// Or in a single line with the static helpers:
string oneLine = TsgcHTMLComponent_Video.Build("/media/intro.mp4",
    TsgcHTMLMediaType.mtVideo, true);
string yt = TsgcHTMLComponent_Video.BuildYouTube("dQw4w9WgXcQ", "100%", "400");

Propiedades y métodos clave

Los miembros que más vas a usar.

Fuente

Src establece la URL del medio y MediaType (TsgcHTMLMediaType: mtVideo, mtAudio) elige el elemento renderizado.

Reproducción

Controls, Autoplay, Loop y Muted se asignan directamente a los atributos multimedia de HTML5.

Tamaño

Width y Height establecen las dimensiones del reproductor; Responsive envuelve un vídeo en un contenedor de proporción adaptable 16:9.

Póster

Poster muestra un fotograma de marcador de posición antes de que un vídeo se reproduzca; VideoID establece el id del DOM.

YouTube

BuildYouTube(aVideoID, aWidth, aHeight) devuelve un iframe incrustado de YouTube adaptable en una única llamada estática.

Construcción de una línea

Build(aSrc, aMediaType, aControls) devuelve el HTML del reproductor en una única llamada estática; HTML renderiza una instancia configurada.

Sigue explorando

Todos los componentes sgcHTMLExplora la matriz completa de más de 60 componentes.
Descargar prueba gratuitaLa prueba de 30 días incluye los proyectos demo 60.HTML.
PreciosLicencias Single, Team y Site con código fuente completo.

¿Listo para empezar?

Descarga la prueba gratuita y empieza a crear interfaces web en Delphi, C++ Builder y .NET.