MuSIQI Stream Player
Posted: Mon Sep 14, 2020 11:50 am
This is my first project created using Chromium VCL (DCEF4). Thank you for salvadordf
Please download for those who are interested. Sorry, the tutorial still uses Indonesian. But I believe this is easy to understand
You Can download form https://drive.google.com/file/d/1WZmIgl ... sp=sharing

I still have problem to start video autoplay
To Play Video in mode Embed i use :
And in Watch mode I use :
Note :IDX is Youtube Video ID
Please download for those who are interested. Sorry, the tutorial still uses Indonesian. But I believe this is easy to understand
You Can download form https://drive.google.com/file/d/1WZmIgl ... sp=sharing
I still have problem to start video autoplay
Code: Select all
procedure TfrmMain.CreateCode(c:string);
var
t : string;
s : TStringList;
cw,ce,jscode : String;
begin
//
if c='' then exit;
ce := DAL.FieldByName('alcode1').AsString;
cw := DAL.FieldByName('alcode2').AsString;
if ckEmbed.Checked then
begin
t := AnsiReplaceStr(ce,'IDX',c);
try
s:= TStringList.create;
s.Text := t ;
s.SaveToFile(ExtractFilePath(Application.ExeName)+ 'now.htm');
sleep(1000);
Chromium1.LoadURL(ExtractFilePath(Application.ExeName)+ 'now.htm');
finally
s.free;
end;
end
else
begin
t := AnsiReplaceStr(cw,'IDX',c);
Chromium1.LoadURL(t );
{ This Javascript not working }
jscode:= 'document.getElementsByClassName("ytp-play-button")[0].click()';
Chromium1.Browser.MainFrame.ExecuteJavaScript(jsCode, 'about:blank', 0);
end;
eFilter.SetFocus;
end;
Code: Select all
<div id="player"></div>
<script src="http://www.youtube.com/player_api"></script>
<script>
// create youtube player
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
width: '100%',
height: '100%',
videoId: 'IDX',
autoplay: 1,
events: {
onReady: onPlayerReady,
onStateChange: onPlayerStateChange
}
});
}
// autoplay video
function onPlayerReady(event) {
event.target.playVideo();
}
// when video ends
function onPlayerStateChange(event) {
if(event.data === 0) {
location.replace("#?NextPlay");
event.target.playVideo();
}
}
</script>
Code: Select all
https://www.youtube.com/watch?v=IDX&autoplay=1&fs=1&iv_load_policy=3&showinfo=0&rel=0&cc_load_policy=1&start=0&end=0&vq=hd1080&vq=hd720
Note :IDX is Youtube Video ID