testimonials 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/testimonials/version.rb +1 -1
- data/lib/testimonials/widget.js +24 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f32069743e1abbbe0f5ce913e32e0c37f1e23230c0f5d59bb903dd9189761153
|
|
4
|
+
data.tar.gz: fbae328897d5aea39f1896e55324df8182f08bae09e7907a30510dfd3026c82d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c9345c6257864c1531782f4a7cdd1fd136118aab23898e57ae28723b13a27107f657d865b77947c0ac26de7ed06b143ce8cb2ffd0463a6cfc57c08f28cf90085
|
|
7
|
+
data.tar.gz: 27d79110f0b6e043373e0e2989f7f1947810d2c52a1c6e21b5f71e759739c9762f668e6e05f0bbb8a9e9879e38dcb4b61de8d3d276d626a89b1440e4c3af6e35
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.2
|
|
4
|
+
|
|
5
|
+
- Uploaded videos now get a poster frame too (grabbed from the file
|
|
6
|
+
client-side), so Safari shows a preview instead of a black frame before
|
|
7
|
+
play — previously only recorded videos captured a poster. Best-effort;
|
|
8
|
+
legacy videos with no stored poster are unaffected (re-upload to add one).
|
|
9
|
+
|
|
3
10
|
## 0.4.1
|
|
4
11
|
|
|
5
12
|
- Video poster frames: a still is captured from the camera at record time and
|
data/lib/testimonials/version.rb
CHANGED
data/lib/testimonials/widget.js
CHANGED
|
@@ -715,11 +715,35 @@
|
|
|
715
715
|
var file = input.files && input.files[0];
|
|
716
716
|
if (!file) return;
|
|
717
717
|
state.videoBlob = file;
|
|
718
|
+
// Recorded videos grab their poster from the live preview; uploaded
|
|
719
|
+
// files have no live stream, so grab one from the file itself — else
|
|
720
|
+
// Safari shows a black frame (it won't paint a posterless video).
|
|
721
|
+
capturePosterFromFile(file);
|
|
718
722
|
showStage(formStage(state.formTitle || config.labels.shareTitle));
|
|
719
723
|
});
|
|
720
724
|
input.click();
|
|
721
725
|
}
|
|
722
726
|
|
|
727
|
+
// Load an uploaded video offscreen, seek a hair past the start (frame 0 is
|
|
728
|
+
// often black), and reuse capturePoster's canvas grab. Best-effort and
|
|
729
|
+
// async — if the customer sends before it resolves, no poster, no harm.
|
|
730
|
+
function capturePosterFromFile(file) {
|
|
731
|
+
try {
|
|
732
|
+
var url = URL.createObjectURL(file);
|
|
733
|
+
var probe = document.createElement("video");
|
|
734
|
+
probe.preload = "metadata";
|
|
735
|
+
probe.muted = true;
|
|
736
|
+
probe.playsInline = true;
|
|
737
|
+
var cleanup = function () { try { URL.revokeObjectURL(url); } catch (e) { /* noop */ } };
|
|
738
|
+
probe.addEventListener("loadeddata", function () {
|
|
739
|
+
try { probe.currentTime = Math.min(0.1, (probe.duration || 1) / 2); } catch (e) { cleanup(); }
|
|
740
|
+
});
|
|
741
|
+
probe.addEventListener("seeked", function () { capturePoster(probe); cleanup(); });
|
|
742
|
+
probe.addEventListener("error", cleanup);
|
|
743
|
+
probe.src = url;
|
|
744
|
+
} catch (e) { /* poster is best-effort */ }
|
|
745
|
+
}
|
|
746
|
+
|
|
723
747
|
function stopMedia() {
|
|
724
748
|
if (media.timer) clearInterval(media.timer);
|
|
725
749
|
if (media.recorder && media.recorder.state !== "inactive") {
|