Start story duration when it is a text story
This commit is contained in:
@@ -22,6 +22,20 @@ export async function getStoryDuration(
|
|||||||
return DEFAULT_DURATION;
|
return DEFAULT_DURATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (attachment.textAttachment) {
|
||||||
|
// Minimum 5 seconds. +1 second for every 15 characters past the first
|
||||||
|
// 15 characters (round up).
|
||||||
|
// For text stories that include a link, +2 seconds to the playback time.
|
||||||
|
const length = attachment.textAttachment.text
|
||||||
|
? count(attachment.textAttachment.text)
|
||||||
|
: 0;
|
||||||
|
const additionalSeconds = (Math.ceil(length / 15) - 1) * SECOND;
|
||||||
|
const linkPreviewSeconds = attachment.textAttachment.preview
|
||||||
|
? 2 * SECOND
|
||||||
|
: 0;
|
||||||
|
return DEFAULT_DURATION + additionalSeconds + linkPreviewSeconds;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isDownloaded(attachment) || hasNotResolved(attachment)) {
|
if (!isDownloaded(attachment) || hasNotResolved(attachment)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -56,18 +70,6 @@ export async function getStoryDuration(
|
|||||||
return Math.min(duration, MAX_VIDEO_DURATION);
|
return Math.min(duration, MAX_VIDEO_DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attachment.textAttachment && attachment.textAttachment.text) {
|
|
||||||
// Minimum 5 seconds. +1 second for every 15 characters past the first
|
|
||||||
// 15 characters (round up).
|
|
||||||
// For text stories that include a link, +2 seconds to the playback time.
|
|
||||||
const length = count(attachment.textAttachment.text);
|
|
||||||
const additionalSeconds = (Math.ceil(length / 15) - 1) * SECOND;
|
|
||||||
const linkPreviewSeconds = attachment.textAttachment.preview
|
|
||||||
? 2 * SECOND
|
|
||||||
: 0;
|
|
||||||
return DEFAULT_DURATION + additionalSeconds + linkPreviewSeconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attachment.caption) {
|
if (attachment.caption) {
|
||||||
const length = count(attachment.caption);
|
const length = count(attachment.caption);
|
||||||
const additionalSeconds = (Math.ceil(length / 15) - 1) * SECOND;
|
const additionalSeconds = (Math.ceil(length / 15) - 1) * SECOND;
|
||||||
|
Reference in New Issue
Block a user