videojs-thumbnails plugin shows thumbnails at incorrect time - video.js

I'm trying to use "videojs-thumbnails" plugin from https://github.com/brightcove/videojs-thumbnails and noticed that thumbnail's time, specified in the plugin configuration is not matching the timestamp in the seek bar. Coming across different comments regarding this issue I found suggestion at https://github.com/brightcove/videojs-thumbnails/issues/43 to replace line
mouseTime = Math.floor((left - progressControl.el().offsetLeft) / progressControl.width() * duration);
to
mouseTime = Math.floor((left) / progressControl.width() * duration);
By removing
- progressControl.el().offsetLeft
However, that produces still not exact time match.
Finally I came with redefined value for the
var left
Getting it from the current value of
.vjs-mouse-display
So, my final codes are:
left=parseInt((document.querySelector('.vjs-mouse-display').style.left),10);
mouseTime = Math.floor((left) / progressControl.width() * duration);
Now everything works correctly.
Greatly appreciate for comments/suggestions.

This is NOT an answer to your specific question / issue, but rather, an alternative implentation approach.
I, too, wanted thumbnails for my video(s), so I proto-typed a page
that used videoJS's plugin. I don't recall all the details of the
issues that I ran into trying to use that plugin, but I finally decided
to abandon the plugin, and design an alternative, which has its own
separate 'slider' just above the viewer. [ One 'drags' my slider,
(rather than hover along it, as you do on YouTube's videos), so that it
can work straight-forwardly on touch-screens...i.e. on Android, etc. ]
And, rather than try to extract images from the video in real-time,
(See: How to generate video preview thumbnails for use in VideoJS? ), I chose to prepare the images, ahead of time, using 'ffmpeg' and the cmd-line interface to 'ImageMagick'.
Details of that part are here:
http://weasel.firmfriends.us/GeeksHomePages/subj-video-and-audio.html#implementing-video-thumbnails
My 'proof-of-concept' webpage based on that approach is here:
https://weasel.firmfriends.us/Private3-BB/
I hope this is helpful.

Related

PageNumber in Scripts for ActiveReports 7

I'm not very used to Active Reports and I got an old software using those. The software provide some kind of stripped version of Active Reports Designer 7.
I got a PageFooter section with some fields and I want to remove one to display it only when it's the last page.
Basically, what I want to do is this in scripts :
if (this.PageNumber == this.PageCount) {
Field.Visible = true;
}
I only find one post here that say this.PageNumber should work, but it dosent.
So I tried to use the ReportInfo using the FormatString as {PageNumber}, but I don't seems to be able to read the value using this.ReportInfo.Value or this.ReportInfo.Text
I also tried to make a TextBox, using SummaryType : PageCount. But I'm still unable to read the Value.
So the question is :
How can I know the Page Number and Page Count in the script section?
Or how can I read the value of those textbox I created ?
Thanks a lot!
I think these docs cover what you are looking for:
https://help.grapecity.com/activereports/webhelp/Legacy/AR7Help/OnlineEN/AddPageNumbering.html
https://help.grapecity.com/activereports/webhelp/Legacy/AR7Help/OnlineEN/index.html

Where do I enter moment.js code so a DataTables column appears in my chosen format?

I want to make data like 2022/12/15 (imported from Google Sheets at the moment of page load) display as "Dec 15" in one column, and as "Thu" in another column.
I found the format codes:
moment().format("MMM d"); // "Dec 15" and
moment().format("ddd"); // "Thu".
I read https://momentjs.com/docs/ and https://momentjs.com/guides/, but could not find:
Where do I enter that code?
Can I skip entering that code, and instead just enter this?:
$(document).ready(function () {
$('#example').DataTable({
columnDefs: [
{
targets: 4,
render: DataTable.render.datetime('MMM d'),
},
],
});
});
Perhaps I should separate my questions into different posted questions, but I imagine it will be more helpful for future readers to find the combined challenges asked and answered in a single thread.
I'm using the WordPress plugin "Inline Google Spreadsheet Viewer", which is built on DataTables.
[Edit: I realized I should not paste that code into inline_gdocs_viewer.php, and intended to paste it into igsv-datatables.js. I could not however figure out where to paste within that file. What should I look for to know where to insert it? (The author of that plugin publicly announced that no more support will be given.) Should I post the contents of the js file somewhere so you can see it?]
[Edit 2: Would entering that code make column 5 always displayed in MMM d format, even if I want column 5 to be displayed in a different format? Shouldn't specifying what format to apply to which column happen when I create a page / post and use the shortcode to embed the spreadsheet?]
(I read the plugin's documentation and I read DataTables documentation.)
If my table doesn't have a name, what do I use instead of #example? Do I need to name my table? If so, how? (I tried to find the answer at, for example, https://www.w3schools.com/html/html_tables.asp.)
The source for the longer code came from a live example where the dates were in column 5, but the code says "targets:4". To apply the code to column 3 (for example), should I enter targets:2? I read https://datatables.net/reference/option/columns.render, but bizarrely that didn't address this basic question.
If you're wondering if I upgraded DataTables from the old version that comes with Inline Google Spreadsheet Viewer, yes I did.
If you're wondering if I got the script array to call moment.js, I might have. Into the scripts array I added
,
'moment' => array(
'src' => plugins_url('moment.min.js', __FIL__),
'deps' => array( 'moment' )
)
I'm not sure about the "deps" part. Does it mean dependencies? Was I right to use "moment" twice in that code?
If you only know a possible answer to one of these questions, that's better than nothing, so please do share what you can.
I know the Moment team recommends you choose a different library than Moment for new projects, but DataTables to this day recommends Moment for sorting by Day of the week or sorting by Date.
Thanks
Using moment.js 2.29.2 and DataTables 1.13.1.
What I tried, and what I expected:
I read the documentation for all the programs, and I read forum discussions for all the programs, and I studied examples, expecting to find where to enter the code, but nowhere could I find what to do with it. It was always assumed that that part was already known.

GetResource, dynamic parent.

my problem is the following. I'm currently making a blog-page with get-page, get-resources, form-it, and wayfinder. This question requires a decent amount of knowledge about Modx and snippits. I've got the page numberin and all working and i've got a template page with all my calls in it (called weblogTemplate). This template has the following wayfinder call in it :
[[!getResources? &parents=`5` &limit=`5` &tpl=`blogPost`]]
[[!getPage?
&elementClass=`modSnippet`
&element=`getResources`
&parents=`4`
&depth=`2`
&limit=`5`
&pageNavOuterTpl=`[[+first]][[+prev]][[+pages]][[+next]][[+last]]`
&pageVarKey=`page`
&pageFirstTpl=`<li class="controlFirst"><a[[+classes]][[+title]] href="[[+href]]">Eerste pagina</a></li>`
&pageLastTpl=`<li class="controlLast"><a[[+classes]][[+title]] href="[[+href]]">Laatste pagina</a></li>`
&pagePrevTpl=`<li class="controlPrev"><a[[+classes]][[+title]] href="[[+href]]"><<</a></li>`
&pageNextTpl=`<li class="controlNext"><a[[+classes]][[+title]] href="[[+href]]">>></a></li>`
&includeTVs=`1`
&includeContent=`1`
&tpl=`blogListPost`
]]
as you can see the parent is set here to id number 5. This is fine for the homepage but any child page connected in the blog page also uses the same template and so would also have the same menu as the parent. You could use a fix to simply create 1 template for a page and keep using a different getResource call but keep in mind that it is a blog im making, new pages keep getting added. The user can't (, and wouldn't even understand to) make a template and edit any code. A solution i thought of would be to make the parent id dynamic, so it adjust to whatever page it is currently on. So for example if it was on the page with id number 12 it would make the parent call set to 12 and so show all the content under id number 12. If anyone has any ideas / thoughts / solutions i would be very grateful to hear them.
(a link about wayfinder that i used.)
The best solution would be to use two templates - one for main and one for the blog pages and use in blog templates:
&parents=`[[*id]]`
The problem with the user solveds by setting default_template in the system settings.
This worked for me:
[[!getPage?
&elementClass=`modSnippet`
&element=`getResources`
&parents=`[[*id]]`
&depth=`0`
&limit=`10`
&pageNavOuterTpl=`[[+first]][[+prev]][[+pages]][[+next]][[+last]]`
&pageVarKey=`page`
&pageFirstTpl=`<li class="controlFirst"><a[[+classes]][[+title]] href="[[+href]]">Eerste pagina</a></li>`
&pageLastTpl=`<li class="controlLast"><a[[+classes]][[+title]] href="[[+href]]">Laatste pagina</a></li>`
&pagePrevTpl=`<li class="controlPrev"><a[[+classes]][[+title]] href="[[+href]]"><<</a></li>`
&pageNextTpl=`<li class="controlNext"><a[[+classes]][[+title]] href="[[+href]]">>></a></li>`
&includeTVs=`1`
&includeContent=`1`
&tpl=`blogListPost`
]]
Thanks to Vasis for the provided help.

Selenium IDE : How to use pattern checking for a dynamic id using XPath

In my website there is a recently uploaded image section.
in this section all recently uploaded images are displayed randomly
using firepath i traced the xpath of that location
//div[#id='udtkbdf50']/a/div[2]/div
so on each time page refresh this #id='udtkbdf50' value changes ,only one thing is common that is the value is always starting with u
so i want to use pattern matching technique [regular expression or Globbing Patterns ]
#id='udtkbdf50' for this value and rest of the path i.e /a/div[2]/div will remain same.
//div[contains(#id,'u')]/a/div[2]/div will work.
UPDATE:
//div[starts-with(#id,'u')]/a/div[2]/div will be more specific.
All d best.

TextControl Images/Watermarks

In version 18 of TextControl (http://www.textcontrol.com) there is supposed to be the ability to add background images/watermarks to the document, however I find that the behavior of the various overloads, etc is not working correctly and that the documentation is rather scarce on examples. Does any one have a working example of adding watermarks to a Word document through the ServerTextControl object?
This functionality didn't exist in previous versions, so I recognize it's still rather new, I just find it weird that doing something like
tx.Images.Add(draftImage, pageNumber, location, ImageInsertionMode.BelowTheText);
doesn't actually add the images to the document, but if I use another overload beforehand, it adds both?
I just need a loop along the lines of
foreach (TXTextControl.Page page in pages){
page.Select();
var location = tx.InputPosition.Location;
var pageNumber = page.Number;
tx.Images.Add(draftImage, pageNumber, location, ImageInsertionMode.BelowTheText);
}
where location is supposed to be the beginning of the page.
Any help would be appreciated, this should be simple!
Thank you
Finally got a response to this on their forum, it's not a complete solution, but it works for the most part. Figured I would follow up here, so that anyone who ends up on this page would get the help I wanted.
http://forums.textcontrol.com/showthread.php?325522-Watermarking-Background-Image-on-Saved-Documents-in-X8&p=41815#post41815