expo-video-subtitle 0.7.2 → 0.7.3
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.
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,25 @@ Changes inherited from the upstream base version are not repeated here — see t
|
|
|
7
7
|
[upstream changelog](https://github.com/expo/expo/blob/main/packages/expo-video/CHANGELOG.md)
|
|
8
8
|
for the history of everything that isn't subtitle related.
|
|
9
9
|
|
|
10
|
+
## 0.7.3
|
|
11
|
+
|
|
12
|
+
Hardening only. Nothing here changes what 0.7.2 draws when 0.7.2 works.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **The sign store falls back to the only script it holds when the track id does not match.** The
|
|
17
|
+
parser reads `Format.id` from the `Format` its factory was handed; the overlay reads it from the
|
|
18
|
+
selected text track. Those should be the same value, but if they ever are not, the failure is
|
|
19
|
+
silent and total — signs parse correctly and never appear, which is precisely how the previous two
|
|
20
|
+
delivery attempts failed. With one track loaded there is nothing to be ambiguous about. With
|
|
21
|
+
several it still declines, because a wrong guess would draw one language's typesetting over
|
|
22
|
+
another's.
|
|
23
|
+
|
|
24
|
+
- **The overlay logs what it resolved.** Every way this subsystem has failed so far has been quiet:
|
|
25
|
+
a dropped span, a rejected timestamp, an id that did not match. One line under the `AssSignOverlay`
|
|
26
|
+
tag now says which text track was selected and how many signs were found for it, so the next
|
|
27
|
+
failure is one `logcat` away instead of a bisect.
|
|
28
|
+
|
|
10
29
|
## 0.7.2
|
|
11
30
|
|
|
12
31
|
### Fixed
|
|
@@ -18,6 +18,7 @@ import androidx.annotation.OptIn
|
|
|
18
18
|
import androidx.media3.common.C
|
|
19
19
|
import androidx.media3.common.Player
|
|
20
20
|
import androidx.media3.common.Tracks
|
|
21
|
+
import androidx.media3.common.util.Log
|
|
21
22
|
import androidx.media3.common.util.UnstableApi
|
|
22
23
|
import androidx.media3.ui.PlayerView
|
|
23
24
|
import androidx.media3.ui.SubtitleView
|
|
@@ -101,8 +102,12 @@ internal class AssSignOverlay(context: Context) : View(context), Player.Listener
|
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
private fun resolveScript() {
|
|
104
|
-
val
|
|
105
|
+
val trackId = selectedTextTrackId()
|
|
106
|
+
val next = AssSignStore.get(trackId)
|
|
105
107
|
if (next === script) return
|
|
108
|
+
// Logged because every way this has failed so far has been silent. If signs go missing again,
|
|
109
|
+
// this line says whether the parser filed them and whether the overlay found them.
|
|
110
|
+
Log.d(TAG, "text track $trackId -> ${next?.signs?.size ?: "no"} sign(s)")
|
|
106
111
|
script = next
|
|
107
112
|
layouts = HashMap()
|
|
108
113
|
setActive(emptyList())
|
|
@@ -318,6 +323,7 @@ internal class AssSignOverlay(context: Context) : View(context), Player.Listener
|
|
|
318
323
|
}
|
|
319
324
|
|
|
320
325
|
companion object {
|
|
326
|
+
private const val TAG = "AssSignOverlay"
|
|
321
327
|
private const val OPAQUE = 0xFF000000.toInt()
|
|
322
328
|
|
|
323
329
|
/** Removes the overlay from [playerView], dropping its listener registration with it. */
|
|
@@ -47,9 +47,21 @@ internal object AssSignStore {
|
|
|
47
47
|
scripts[trackId] = script
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Called from the main thread, once per track change.
|
|
52
|
+
*
|
|
53
|
+
* Falls back to the only script on hand when the id does not match. The two ends read `Format.id`
|
|
54
|
+
* from different places — the parser from the `Format` its factory was handed, the overlay from
|
|
55
|
+
* the selected track — and if those ever disagree the failure is silent and total: signs parse
|
|
56
|
+
* perfectly and never appear, which is exactly how the previous delivery route failed. With one
|
|
57
|
+
* track loaded there is no ambiguity to protect against, so the safe answer is the obvious one.
|
|
58
|
+
* With several, a wrong guess would draw one language's typesetting over another's, so it declines.
|
|
59
|
+
*/
|
|
51
60
|
@Synchronized
|
|
52
|
-
fun get(trackId: String?): AssScript?
|
|
61
|
+
fun get(trackId: String?): AssScript? {
|
|
62
|
+
scripts[trackId]?.let { return it }
|
|
63
|
+
return scripts.values.singleOrNull()
|
|
64
|
+
}
|
|
53
65
|
|
|
54
66
|
@Synchronized
|
|
55
67
|
fun clear() {
|
package/package.json
CHANGED