Currently, we embed a video by doing something like
<script type="text/javascript" src="https://videos.bentasker.co.uk/resources/embed/embed.min.js"></script><script type="text/javascript">// <![CDATA[
embedBensPlayer('2021/20210605_sparkler_b1_w_slowmo/sparkler_b1_w_slowmo.mp4_master.m3u8');
// ]]></script></p>
Which then relies on document.write() to be able to insert a player.
That approach works but causes issues (in jira-projects/CDN#13 and websites/BEN#8)
It'd be good if we could implement the ability to do it without document.write(), instead doing something like
<div class="bensvideo" data-src="2021/20210605_sparkler_b1_w_slowmo/sparkler_b1_w_slowmo.mp4_master.m3u8"></div>
<script type="text/javascript" src="https://videos.bentasker.co.uk/resources/embed/embed.min.js">
Where a function would (on DomReady) call getElementsByClassName) and write videos into the relevant div
Activity
11-Mar-22 15:44
assigned to @btasker
11-Mar-22 15:49
This should be feasible.
The current function (
embedBensPlayer) doesAnd then after that, everything references the element by ID, so we could build an alternative entry point that doesn't do that before handing off
11-Mar-22 16:04
mentioned in commit e97ad98666dee46fc41c090584c4164190455788
Commit: e97ad98666dee46fc41c090584c4164190455788 Author: B Tasker Date: 2022-03-11T16:03:27.000+00:00Message
Split
embedBensPlayer()so that all it does directly is usedocument.write(). This is a precursor to adding a new entrypoint for websites/videos.bentasker.co.uk#311-Mar-22 16:18
mentioned in commit f55cec220b0e4cd6ab6118113f796a61d0302b27
Commit: f55cec220b0e4cd6ab6118113f796a61d0302b27 Author: B Tasker Date: 2022-03-11T16:15:49.000+00:00Message
Implement function
embedBensPlayerDivs()for websites/videos.bentasker.co.uk#3This will
embedBensPlayerdata-srcExample usage
The next step is to have it called automatically once the DOM is ready
11-Mar-22 16:18
Commit f55cec22 implements function
embedBensPlayerDivs()for websites/videos.bentasker.co.uk#3This will
embedBensPlayerdata-srcSo to embed a video, you'd do
The next step is to have it called automatically once the DOM is ready
11-Mar-22 16:23
mentioned in commit 475a508bf5598598767a4b2f248dc3a5faef244e
Commit: 475a508bf5598598767a4b2f248dc3a5faef244e Author: B Tasker Date: 2022-03-11T16:23:04.000+00:00Message
Automatically call
embedBensPlayerDivs()when the DOM is ready, so that embedded videos are automatically picked up on. See websites/videos.bentasker.co.uk#311-Mar-22 18:45
mentioned in commit bca8897c2030999ced801c22dab14a60e9ea41f5
Commit: bca8897c2030999ced801c22dab14a60e9ea41f5 Author: B Tasker Date: 2022-03-11T18:45:10.000+00:00Message
Prevent multiple dom ready events from being queued (related to websites/videos.bentasker.co.uk#3)
12-Mar-22 11:42
mentioned in issue #5