You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "ebarboni (via GitHub)" <gi...@apache.org> on 2024/03/05 17:49:31 UTC

[PR] asciidoc extension to manage video [netbeans-antora]

ebarboni opened a new pull request, #13:
URL: https://github.com/apache/netbeans-antora/pull/13

   Create a new tag for our site that permit generation of html that is compatible with privacy statement.
   Video cannot be directly embedded and usr must consent before launching.
   
   basicaly replace **video::** by **avideo::** 
   
   Example here, on one page:
   
   https://github.com/apache/netbeans-antora-site/pull/16/
   Text at the bottom of the video can be shown on this screenshot
   ![image](https://github.com/apache/netbeans-antora/assets/6940099/c413d893-b3e5-4f59-a8fa-c35d5fce65ab)
   
   I didn't yet tackle css stuff and the js is a bit brutal.
   
   The generation try to use asciidoc itself to help resolving the image. (If we miss an image we have an error on antora level that help finding missing one)
   
   
   Sidenote:
   https://github.com/apache/netbeans-antora-site/pull/16/ contains image wget from this pattern https://i1.ytimg.com/vi/<videocode>/hq1.jpg I hope this is ok to server from our site.
   
   In the current website video are blocked by **CSP**. This PR may allow to further customise our output if we need a link instead of embedded video.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] asciidoc extension to manage video [netbeans-antora]

Posted by "ebarboni (via GitHub)" <gi...@apache.org>.
ebarboni commented on PR #13:
URL: https://github.com/apache/netbeans-antora/pull/13#issuecomment-1997305016

   Result is there: 
   https://netbeans.apache.org/front/main/help/getting-started/ 
   
   Some css adjustment will be needed, and also the click is not working as per ASF CSP policy, we should relax to allow youtube but I did not have succeed overriding/merging CSP with htaccess.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] asciidoc extension to manage video [netbeans-antora]

Posted by "ebarboni (via GitHub)" <gi...@apache.org>.
ebarboni commented on PR #13:
URL: https://github.com/apache/netbeans-antora/pull/13#issuecomment-1997078646

   I think it was kind of mandatory to have to comply asf policy. 
   
   https://privacy.apache.org/policies/website-policy.html (outdated PR in revision to match the later)
   ~~"YouTube content can be embedded only when the creator has given consent before loading any file from YouTube."~~
   
   https://privacy.apache.org/faq/committers.html
   Yes, you can embed videos on the website, but they should load only after the user actively wants them to load. Arrange this by showing a placeholder image first and loading the video after the user clicks on the image. Make it clear that users who click the image will load a video from a third party.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] asciidoc extension to manage video [netbeans-antora]

Posted by "ebarboni (via GitHub)" <gi...@apache.org>.
ebarboni commented on PR #13:
URL: https://github.com/apache/netbeans-antora/pull/13#issuecomment-1997251272

   merging this one + the test on the site.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] asciidoc extension to manage video [netbeans-antora]

Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #13:
URL: https://github.com/apache/netbeans-antora/pull/13#discussion_r1523828544


##########
lib/a-video.js:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+'use strict'
+
+function avideo() {
+
+    const self = this
+    // should react on avideo::
+    self.named('avideo')
+    self.process(function (parent, target, attrs) {
+        // rewrite the youtube code as image (  get from  https://i1.ytimg.com/vi/<videocode>/hq1.jpg )
+        let imagetarget = './' + target + '.jpg'
+        // get and id
+        let idofvideoplaceholder = target + 'placeholder';
+        
+        // prepare attribute list for image
+        let attribute = {'target': imagetarget, 'alt': 'placeholder for video ' + target}
+        // script to play on click
+        let script = `<script>
+        function loadScript() {
+            return new Promise((resolve, reject) => {
+                let script = document.createElement('script');
+                script.src = 'https://www.youtube.com/iframe_api';
+                script.addEventListener('load', resolve);
+                script.addEventListener('error', (e) => reject(e));
+                document.body.appendChild(script);                
+            });
+        }
+
+        function addElement() {
+            loadScript().then(() => {
+                window.YT.ready(function() {
+                    let player = new YT.Player('${idofvideoplaceholder}', {
+                    height: '490',
+                    width: '968',
+                    videoId: '${target}',
+                    playerVars: {
+                        'playsinline': 1
+                    },
+                    events: {
+                        'onReady': (event) => {
+                            event.target.playVideo();
+                        }
+                    }
+                    });
+                });
+            });
+        }
+
+        var container = document.querySelector('#${idofvideoplaceholder} .content');
+        container.addEventListener('click', addElement);
+    </script>`
+
+        const nodes = []
+        // create div wrapper with id of video for the script to get the correct video
+        nodes.push(self.createBlock(parent, 'pass', `<div class="videoconsentblock" id="${idofvideoplaceholder}">`))
+        // get image should be local
+        // using block will trigger issue on image target not found
+        nodes.push(self.createBlock(parent, 'image', "", attribute))
+        nodes.push(self.createBlock(parent, 'pass', `</div>`))
+        // Apache privacy 
+        nodes.push(self.createBlock(parent, 'paragraph', 'Clicking on the image above will load and send data from and to Google'))

Review Comment:
   `Clicking on the image above will load and send data from and to Google`
   
   ->
   
   `Clicking on the image above will load the video and send data from and to Google`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] asciidoc extension to manage video [netbeans-antora]

Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #13:
URL: https://github.com/apache/netbeans-antora/pull/13#issuecomment-1998295797

   > Yes, you can embed videos on the website, but they should load only after the user actively wants them to load. 
   
   right. thats due to [GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation). Since video hosts and social media collect as much data as they can get away with, actions like viewing embedded content would require user permission. But even without that, I think it is good behavior to ask users first before embedding third party hosted content. We did this already back when applets existed which was all well before cookie banner times.
   
   > Some css adjustment will be needed
   
   a hand cursor would be also nice so that it indicates that the image is clickable.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] asciidoc extension to manage video [netbeans-antora]

Posted by "ebarboni (via GitHub)" <gi...@apache.org>.
ebarboni merged PR #13:
URL: https://github.com/apache/netbeans-antora/pull/13


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists