Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

27
LINES

< > BotCompany Repo | #1014052 // embedYoutube_newer (newer version with iframe)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2961L/18K).

static S embedYoutube_newer(S youtubeID, O... _) {
  ret embedYoutube_newer(youtubeID, 300, _);
}

static S embedYoutube_newer(S youtubeID, int w, O... _) {
  ret embedYoutube_newer(youtubeID, w, sixteenToNine(w), _);
}

static S embedYoutube_newer(S youtubeID, int w, int h, O... _) {
  bool loop;
  if (first(_) instanceof Bool) {
    loop = true;
    _ = dropFirst(_);
  }
  optPar bool autoPlay;
  
  youtubeID = extractYouTubeID(youtubeID);
  ret iframe(appendQueryToURL("https://www.youtube.com/embed/" + youtubeID,
      playlist := loop ? youtubeID : null,
      autoplay := autoPlay ? 1 : null,
      loop := loop ? 1 : 0),
    width := w,
    height := h,
    frameborder := 0,
    allow := "autoplay; encrypted-media",
    allowfullscreen := html_valueLessParam());
}

Author comment

Began life as a copy of #1013735

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1014052
Snippet name: embedYoutube_newer (newer version with iframe)
Eternal ID of this version: #1014052/14
Text MD5: 90090bab12e0c2beb90faef1c9c59e24
Transpilation MD5: 008d1b59578eaa5b04fb48611e785841
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-27 17:59:29
Source code size: 804 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 530 / 588
Version history: 13 change(s)
Referenced in: [show references]