Skip to content

Opus image preview no longer works #2086

Closed Answered by hakan-demirli
hakan-demirli asked this question in 1. Q&A
Discussion options

You must be logged in to vote
  • Install ffmpegthumbnailer
  • create plugins/opus-preview.yazi/init.lua file with the following content:
local M = {}


function M:peek(job)
	local start, cache = os.clock(), ya.file_cache(job)
	if not cache or self:preload(job) ~= 1 then
		return
	end

	ya.sleep(math.max(0, PREVIEW.image_delay / 1000 + start - os.clock()))
	ya.image_show(cache, job.area)
	ya.preview_widgets(job, {})
end

function M:seek(job)
	local h = cx.active.current.hovered
	if h and h.url == job.file.url then
		ya.manager_emit("peek", {
			math.max(0, cx.active.preview.skip + job.units),
			only_if = job.file.url,
		})
	end
end

function M:preload(job)
	local percent = 5 + job.skip
	if percent > 95 then
		ya.manager_emit

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@hakan-demirli
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by hakan-demirli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
1. Q&A
Labels
None yet
2 participants