You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2014/03/03 17:25:32 UTC
[1/2] spec commit: CB-6051: Test HTML5 video with native URLs
Repository: cordova-mobile-spec
Updated Branches:
refs/heads/master 74de382ad -> f6c9c2cc0
CB-6051: Test HTML5 video with native URLs
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/39f214e9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/39f214e9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/39f214e9
Branch: refs/heads/master
Commit: 39f214e9750dfdd4b124429e27bcbc2419a41a27
Parents: 74de382
Author: Ian Clelland <ic...@chromium.org>
Authored: Mon Mar 3 11:23:40 2014 -0500
Committer: Ian Clelland <ic...@chromium.org>
Committed: Mon Mar 3 11:24:18 2014 -0500
----------------------------------------------------------------------
config.xml | 1 +
file/index.html | 45 +++++++++++++++++++++++++++++++++------------
2 files changed, 34 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/39f214e9/config.xml
----------------------------------------------------------------------
diff --git a/config.xml b/config.xml
index 80a7dd5..9550311 100644
--- a/config.xml
+++ b/config.xml
@@ -29,6 +29,7 @@
<access origin="http://*.apache.org" />
<access origin="https://*.apache.org" />
<access origin="http://www.google.com" />
+ <access origin="http://techslides.com" />
<access origin="httpssss://example.com" />
<preference name="iosPersistentFileLocation" value="Library" />
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/39f214e9/file/index.html
----------------------------------------------------------------------
diff --git a/file/index.html b/file/index.html
index 8b4da1a..be5edaa 100644
--- a/file/index.html
+++ b/file/index.html
@@ -34,6 +34,9 @@
var deviceReady = false;
+ var imageURL = "http://apache.org/images/feather-small.gif";
+ var videoURL = "http://techslides.com/demos/sample-videos/small.mp4";
+
/**
* Function called when page has finished loading.
*/
@@ -53,6 +56,8 @@
function bindEvents() {
document.getElementById('downloadImgCDV').addEventListener('click', downloadImgCDV, false);
document.getElementById('downloadImgNative').addEventListener('click', downloadImgNative, false);
+ document.getElementById('downloadVideoCDV').addEventListener('click', downloadVideoCDV, false);
+ document.getElementById('downloadVideoNative').addEventListener('click', downloadVideoNative, false);
}
function clearLog() {
@@ -76,31 +81,45 @@
};
}
+ function downloadImgCDV(ev) {
+ ev.preventDefault();
+ ev.stopPropagation();
+ downloadImg(imageURL, function(entry) { return entry.toURL(); }, new Image());
+ }
+
function downloadImgNative(ev) {
ev.preventDefault();
ev.stopPropagation();
- downloadImg(function(entry) { return entry.toNativeURL(); });
+ downloadImg(imageURL, function(entry) { return entry.toNativeURL(); }, new Image);
}
- function downloadImgCDV(ev) {
+ function downloadVideoCDV(ev) {
+ ev.preventDefault();
+ ev.stopPropagation();
+ var videoElement = document.createElement('video');
+ videoElement.controls = "controls";
+ downloadImg(videoURL, function(entry) { return entry.toURL(); }, videoElement);
+ }
+
+ function downloadVideoNative(ev) {
ev.preventDefault();
ev.stopPropagation();
- downloadImg(function(entry) { return entry.toURL(); });
+ var videoElement = document.createElement('video');
+ videoElement.controls = "controls";
+ downloadImg(videoURL, function(entry) { return entry.toNativeURL(); }, videoElement);
}
- function downloadImg(urlFn) {
- var filename = "feather0.gif";
+ function downloadImg(source, urlFn, element) {
+ var filename = source.substring(source.lastIndexOf("/")+1);
function download(fileSystem) {
var ft = new FileTransfer();
- var imageURL = "http://apache.org/images/feather-small.gif";
logMessage("Starting download");
- ft.download(imageURL, fileSystem.root.toURL() + "/" + filename, function(entry) {
+ ft.download(source, fileSystem.root.toURL() + filename, function(entry) {
logMessage("Download complete")
- var imgElement = new Image();
- imgElement.src = urlFn(entry)
- logMessage("Image URL is " + imgElement.src, "green");
- logMessage("Inserting image");
- document.getElementById("output").appendChild(imgElement);
+ element.src = urlFn(entry)
+ logMessage("Src URL is " + element.src, "green");
+ logMessage("Inserting element");
+ document.getElementById("output").appendChild(element);
}, logError("ft.download"));
}
clearLog();
@@ -126,6 +145,8 @@
<h2>File</h2>
<div class="btn large" id="downloadImgCDV">Download and display img (cdvfile)</div>
<div class="btn large" id="downloadImgNative">Download and display img (native)</div>
+ <div class="btn large" id="downloadVideoCDV">Download and play video (cdvfile)</div>
+ <div class="btn large" id="downloadVideoNative">Download and play video (native)</div>
<div id="log"></div>
<div id="output"></div>
[2/2] spec commit: CB-4952: Test handling of file:///private/ URLs
Posted by ia...@apache.org.
CB-4952: Test handling of file:///private/ URLs
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/f6c9c2cc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/f6c9c2cc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/f6c9c2cc
Branch: refs/heads/master
Commit: f6c9c2cc05fea41261e40f9c9306c11badc4b20a
Parents: 39f214e
Author: Ian Clelland <ic...@chromium.org>
Authored: Mon Mar 3 11:24:57 2014 -0500
Committer: Ian Clelland <ic...@chromium.org>
Committed: Mon Mar 3 11:24:57 2014 -0500
----------------------------------------------------------------------
file/index.html | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/f6c9c2cc/file/index.html
----------------------------------------------------------------------
diff --git a/file/index.html b/file/index.html
index be5edaa..e4a9ce4 100644
--- a/file/index.html
+++ b/file/index.html
@@ -58,6 +58,7 @@
document.getElementById('downloadImgNative').addEventListener('click', downloadImgNative, false);
document.getElementById('downloadVideoCDV').addEventListener('click', downloadVideoCDV, false);
document.getElementById('downloadVideoNative').addEventListener('click', downloadVideoNative, false);
+ document.getElementById('testPrivateURL').addEventListener('click', testPrivateURL, false);
}
function clearLog() {
@@ -136,6 +137,28 @@
});
}, logError("requestFileSystem"));
}
+
+ function testPrivateURL(ev) {
+ ev.preventDefault();
+ ev.stopPropagation();
+ requestFileSystem(TEMPORARY, 0, function(fileSystem) {
+ logMessage("Temporary root is at " + fileSystem.root.toNativeURL());
+ fileSystem.root.getFile("testfile", {create: true}, function(entry) {
+ logMessage("Temporary file is at " + entry.toNativeURL());
+ if (entry.toNativeURL().substring(0,12) == "file:///var/") {
+ logMessage("File starts with /var/, trying /private/var");
+ var newURL = "file://localhost/private/var/" + entry.toNativeURL().substring(12) + "?and=another_thing";
+ //var newURL = entry.toNativeURL();
+ logMessage(newURL, 'blue');
+ resolveLocalFileSystemURL(newURL, function(newEntry) {
+ logMessage("Successfully resolved.", 'green');
+ logMessage(newEntry.toURL(), 'blue');
+ logMessage(newEntry.toNativeURL(), 'blue');
+ }, logError("resolveLocalFileSystemURL"));
+ }
+ }, logError("getFile"));
+ }, logError("requestFileSystem"));
+ }
</script>
</head>
@@ -148,6 +171,8 @@
<div class="btn large" id="downloadVideoCDV">Download and play video (cdvfile)</div>
<div class="btn large" id="downloadVideoNative">Download and play video (native)</div>
+ <div class="btn large" id="testPrivateURL">Test /private/ URL (iOS)</div>
+
<div id="log"></div>
<div id="output"></div>
<h2> </h2><div class="backBtn" onclick="backHome();">Back</div>