From 3a6faa675cdaea5e7edc83b6bd696ee68af70af8 Mon Sep 17 00:00:00 2001 From: morille Date: Mon, 23 May 2016 15:03:50 +0200 Subject: [PATCH] Allow playing videos using "cdvfile" protocol The webview refuses to play any video using the "cdvfile://" scheme, adding the "Content-length" http header fixes that issue. --- src/ios/CDVFile.m | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ios/CDVFile.m b/src/ios/CDVFile.m index ce360698a..4d0300208 100644 --- a/src/ios/CDVFile.m +++ b/src/ios/CDVFile.m @@ -167,6 +167,7 @@ - (void)startLoading if (!error) { responseHeaders[@"Content-Type"] = mimetype; + responseHeaders[@"Content-Length"] = [NSString stringWithFormat: @"%ld", (long)data.length]; NSURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:url.url statusCode:200 HTTPVersion:@"HTTP/1.1"headerFields:responseHeaders]; [[weakSelf client] URLProtocol:weakSelf didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed]; [[weakSelf client] URLProtocol:weakSelf didLoadData:data];