-
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c123be1
commit 28e173b
Showing
23 changed files
with
1,986 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# hwdec: try to use hardware decoding | ||
hwdec=mediacodec-copy | ||
hwdec-codecs="h264,hevc,mpeg4,mpeg2video,vp8,vp9" | ||
gpu-dumb-mode=auto | ||
# tls: allow self signed certificate | ||
tls-verify=no | ||
tls-ca-file="" | ||
# demuxer: limit cache to 32 MiB, the default is too high for mobile devices | ||
demuxer-max-bytes=32MiB | ||
demuxer-max-back-bytes=32MiB | ||
# sub: scale subtitles with video | ||
sub-scale-with-window=no | ||
sub-use-margins=no |
6 changes: 3 additions & 3 deletions
6
...src/main/assets/native/ExoPlayerPlugin.js → .../main/assets/native/NativePlayerPlugin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
MAX_SPEED = 100 | ||
ONE_SECOND = 1 | ||
skip = false | ||
ov = mp.create_osd_overlay("ass-events") | ||
ov.data = "Seeking..." | ||
-- Max noise (dB) and min silence duration (s) to trigger | ||
opts = { quietness = -30, duration = 0.5 } | ||
|
||
|
||
function setOptions() | ||
local options = require 'mp.options' | ||
options.read_options(opts) | ||
end | ||
|
||
function setTime(time) | ||
mp.set_property_number('time-pos', time) | ||
end | ||
|
||
function getTime() | ||
return mp.get_property_native('time-pos') | ||
end | ||
|
||
function setSpeed(speed) | ||
mp.set_property('speed', speed) | ||
end | ||
|
||
function getSpeed() | ||
return mp.get_property('speed') | ||
end | ||
|
||
function setPause(state) | ||
mp.set_property_bool('pause', state) | ||
end | ||
|
||
function setMute(state) | ||
mp.set_property_bool('mute', state) | ||
end | ||
|
||
function initAudioFilter() | ||
local af_table = mp.get_property_native('af') | ||
af_table[#af_table + 1] = { | ||
enabled = false, | ||
label = 'silencedetect', | ||
name = 'lavfi', | ||
params = { graph = 'silencedetect=noise=' .. opts.quietness .. 'dB:d=' .. opts.duration } | ||
} | ||
mp.set_property_native('af', af_table) | ||
end | ||
|
||
function initVideoFilter() | ||
local vf_table = mp.get_property_native('vf') | ||
vf_table[#vf_table + 1] = { | ||
enabled = false, | ||
label = 'blackout', | ||
name = 'lavfi', | ||
params = { graph = '' } | ||
} | ||
mp.set_property_native('vf', vf_table) | ||
end | ||
|
||
function setAudioFilter(state) | ||
local af_table = mp.get_property_native('af') | ||
if #af_table > 0 then | ||
for i = #af_table, 1, -1 do | ||
if af_table[i].label == 'silencedetect' then | ||
af_table[i].enabled = state | ||
mp.set_property_native('af', af_table) | ||
break | ||
end | ||
end | ||
end | ||
end | ||
|
||
function dim(state) | ||
local dim = { width = 0, height = 0 } | ||
if state == true then | ||
dim.width = mp.get_property_native('width') | ||
dim.height = mp.get_property_native('height') | ||
end | ||
return dim.width .. 'x' .. dim.height | ||
end | ||
|
||
function setVideoFilter(state) | ||
local vf_table = mp.get_property_native('vf') | ||
if #vf_table > 0 then | ||
for i = #vf_table, 1, -1 do | ||
if vf_table[i].label == 'blackout' then | ||
vf_table[i].enabled = state | ||
vf_table[i].params = { graph = 'nullsink,color=c=black:s=' .. dim(state) } | ||
mp.set_property_native('vf', vf_table) | ||
break | ||
end | ||
end | ||
end | ||
end | ||
|
||
function silenceTrigger(name, value) | ||
if value == '{}' or value == nil then | ||
return | ||
end | ||
|
||
local skipTime = tonumber(string.match(value, '%d+%.?%d+')) | ||
local currTime = getTime() | ||
|
||
if skipTime == nil or skipTime < currTime + ONE_SECOND then | ||
return | ||
end | ||
|
||
stopSkip() | ||
setTime(skipTime) | ||
skip = false | ||
end | ||
|
||
function setAudioTrigger(state) | ||
if state == true then | ||
mp.observe_property('af-metadata/silencedetect', 'string', silenceTrigger) | ||
else | ||
mp.unobserve_property(silenceTrigger) | ||
end | ||
end | ||
|
||
function startSkip() | ||
ov:update() | ||
startTime = getTime() | ||
startSpeed = getSpeed() | ||
-- This audio filter detects moments of silence | ||
setAudioFilter(true) | ||
-- This video filter makes fast-forward faster | ||
setVideoFilter(true) | ||
setAudioTrigger(true) | ||
setPause(false) | ||
setMute(true) | ||
setSpeed(MAX_SPEED) | ||
end | ||
|
||
function stopSkip() | ||
ov:remove() | ||
setAudioFilter(false) | ||
setVideoFilter(false) | ||
setAudioTrigger(false) | ||
setMute(false) | ||
setSpeed(startSpeed) | ||
end | ||
|
||
function keypress() | ||
skip = not skip | ||
if skip then | ||
startSkip() | ||
else | ||
stopSkip() | ||
setTime(startTime) | ||
end | ||
end | ||
|
||
setOptions(opts) | ||
initAudioFilter() | ||
initVideoFilter() | ||
|
||
mp.add_key_binding(nil, 'skip-key', keypress) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.