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 — renderiza un reproductor de vídeo o audio HTML5 adaptable, más un ayudante para incrustar YouTube, en Delphi, C++ Builder y .NET.
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.
TsgcHTMLComponent_Video
Multimedia HTML5 <video> / <audio>
Delphi, C++ Builder, .NET
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");
Los miembros que más vas a usar.
Src establece la URL del medio y MediaType (TsgcHTMLMediaType: mtVideo, mtAudio) elige el elemento renderizado.
Controls, Autoplay, Loop y Muted se asignan directamente a los atributos multimedia de HTML5.
Width y Height establecen las dimensiones del reproductor; Responsive envuelve un vídeo en un contenedor de proporción adaptable 16:9.
Poster muestra un fotograma de marcador de posición antes de que un vídeo se reproduzca; VideoID establece el id del DOM.
BuildYouTube(aVideoID, aWidth, aHeight) devuelve un iframe incrustado de YouTube adaptable en una única llamada estática.
Build(aSrc, aMediaType, aControls) devuelve el HTML del reproductor en una única llamada estática; HTML renderiza una instancia configurada.