Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
fix: Add CC on inline videos (#204)
Browse files Browse the repository at this point in the history
* Update WKWebViewGenerator.swift

* Update WKWebViewGeneratorSpec.swift
  • Loading branch information
BisuGit committed Jul 15, 2021
1 parent 212dab7 commit 01920b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Source/View Generators/WKWebViewGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class WKWebViewGenerator {

private static func getWebViewURL(from input: String) -> URL? {
if let youTubeID = input.getSubstring(inBetween: RichTextViewConstants.youtubeStartTag, and: RichTextViewConstants.videoEndTag) {
return URL(string: "https://www.youtube.com/embed/" + youTubeID + "?playsinline=1")
return URL(string: "https://www.youtube.com/embed/" + youTubeID + "?playsinline=1&cc_load_policy=1")
} else if let vimeoID = input.getSubstring(inBetween: RichTextViewConstants.vimeoStartTag, and: RichTextViewConstants.videoEndTag) {
return URL(string: "https://player.vimeo.com/video/" + vimeoID + "?title=0&byline=0&portrait=0")
}
Expand Down
2 changes: 1 addition & 1 deletion UnitTests/View Generators/WKWebViewGeneratorSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class WKWebViewGeneratorSpec: QuickSpec {
it("properly generates a YouTube WebView") {
let webview = WKWebViewGenerator.getWebView(from: "youtube[1234]")
expect(webview?.configuration.allowsInlineMediaPlayback).to(beTrue())
expect(webview?.url?.absoluteString).to(equal("https://www.youtube.com/embed/1234?playsinline=1"))
expect(webview?.url?.absoluteString).to(equal("https://www.youtube.com/embed/1234?playsinline=1&cc_load_policy=1"))
}
it("properly generates a Vimeo WebView") {
let webview = WKWebViewGenerator.getWebView(from: "vimeo[1234]")
Expand Down

0 comments on commit 01920b7

Please sign in to comment.