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).

1  
static S embedYoutube_newer(S youtubeID, O... _) {
2  
  ret embedYoutube_newer(youtubeID, 300, _);
3  
}
4  
5  
static S embedYoutube_newer(S youtubeID, int w, O... _) {
6  
  ret embedYoutube_newer(youtubeID, w, sixteenToNine(w), _);
7  
}
8  
9  
static S embedYoutube_newer(S youtubeID, int w, int h, O... _) {
10  
  bool loop;
11  
  if (first(_) instanceof Bool) {
12  
    loop = true;
13  
    _ = dropFirst(_);
14  
  }
15  
  optPar bool autoPlay;
16  
  
17  
  youtubeID = extractYouTubeID(youtubeID);
18  
  ret iframe(appendQueryToURL("https://www.youtube.com/embed/" + youtubeID,
19  
      playlist := loop ? youtubeID : null,
20  
      autoplay := autoPlay ? 1 : null,
21  
      loop := loop ? 1 : 0),
22  
    width := w,
23  
    height := h,
24  
    frameborder := 0,
25  
    allow := "autoplay; encrypted-media",
26  
    allowfullscreen := html_valueLessParam());
27  
}

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: 428 / 491
Version history: 13 change(s)
Referenced in: [show references]