-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement opacity to control visibility of subtitles (#3583)
* feat: implement opacity to control visibility of subtitles implemented per discussion on #3579 updated docs and linked onTextTrackDataChanged to the subtitle style to clarify intent on how to control visibility. * chore: update type so that we use a union of 0 1 vs any number * chore: run ktlint to get rid of white spaces * feat: add ability to have range of numbers for opacity; while, 0 will still not render the subtitles. added util function for safeGetFloat updated types * feat: add ability to suppress subtitles with opacity 0 add data structure for subtitle styles for extensibility * chore: run yarn check-ios * chore: update documentation to clarify differences between android and ios * Update android/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java Co-authored-by: Olivier Bouillet <[email protected]> --------- Co-authored-by: Olivier Bouillet <[email protected]>
- Loading branch information
Showing
11 changed files
with
52 additions
and
2 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
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
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,17 @@ | ||
struct SubtitleStyle { | ||
// Extend with more style properties as needed. | ||
private(set) var opacity: CGFloat | ||
|
||
enum SubtitleStyleKeys { | ||
static let opacity = "opacity" | ||
} | ||
|
||
init(opacity: CGFloat = 1) { | ||
self.opacity = opacity | ||
} | ||
|
||
static func parse(from dictionary: [String: Any]?) -> SubtitleStyle { | ||
let opacity = dictionary?[SubtitleStyleKeys.opacity] as? CGFloat ?? 1 | ||
return SubtitleStyle(opacity: opacity) | ||
} | ||
} |
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
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