From: Pawel Andruszkiewicz Date: Mon, 14 Dec 2015 07:18:45 +0000 (+0900) Subject: Revert "[Media] Adding support for virtual paths" X-Git-Tag: submit/tizen/20151221.111205^2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=495794d08e4d4b5c6587fe1076269c60234babf1;p=platform%2Fcore%2Fapi%2Fcordova-plugins.git Revert "[Media] Adding support for virtual paths" This reverts commit 592584b262f24c1a8506d4eedbfc7e3383bc6210. Change-Id: I4420718dadd1b4e84da1ae104bc5f55b28943adf --- diff --git a/sample/plugins/media/media.js b/sample/plugins/media/media.js index 28d344c..405e2eb 100644 --- a/sample/plugins/media/media.js +++ b/sample/plugins/media/media.js @@ -35,7 +35,7 @@ var deviceReady = function () { console.log(files[i].fullPath); if(!(files[i].name in playfiles) ){ playfiles[files[i].name] = files[i]; - table.row.add([i + '.', 'documents/' + files[i].name]).draw(false); + table.row.add([i + '.', '/opt/usr/media/Documents/' + files[i].name]).draw(false); } } }); @@ -200,7 +200,7 @@ function stopRecAudio() { console.log(files[i].fullPath); if(!(files[i].name in playfiles) ){ playfiles[files[i].name] = files[i]; - table.row.add([i + '.', 'documents' + files[i].name]).draw(false); + table.row.add([i + '.', '/opt/usr/media/Documents/' + files[i].name]).draw(false); } } }); diff --git a/src/media/cordova_media.gyp b/src/media/cordova_media.gyp index e94b863..4a43c14 100644 --- a/src/media/cordova_media.gyp +++ b/src/media/cordova_media.gyp @@ -10,8 +10,6 @@ 'cordova_media_api.js', 'cordova_media_extension.cc', 'cordova_media_extension.h', - 'cordova_media_instance.h', - 'cordova_media_instance.cc', ], 'include_dirs': [ '../', @@ -19,7 +17,6 @@ ], 'variables': { 'packages': [ - 'storage', 'webapi-plugins', ], }, diff --git a/src/media/cordova_media_api.js b/src/media/cordova_media_api.js index 4398e60..f9f3931 100755 --- a/src/media/cordova_media_api.js +++ b/src/media/cordova_media_api.js @@ -17,25 +17,6 @@ // TODO: remove when added to public cordova repository -> begin var plugin_name = 'cordova-plugin-media.tizen.Media'; -var utils_ = xwalk.utils; -var native_ = new utils_.NativeManager(extension); -var privilege_ = xwalk.utils.privilege; - -function GetRealPath(virtualPath) { - - console.log("JS GetRealPath " + virtualPath); - xwalk.utils.checkPrivilegeAccess(privilege_.FILESYSTEM_READ); - - var data = { - path : virtualPath - }; - - var result = native_.callSync('CordovaMediaInstance_GetRealPath', data); - var fullResult = native_.getResultObject(result); - console.log("Result of call " + fullResult.path); - return fullResult.path; -} - cordova.define(plugin_name, function(require, exports, module) { // TODO: remove -> end @@ -231,10 +212,9 @@ cordova.define(plugin_name, function(require, exports, module) { create: function(successCallback, errorCallback, args) { var id = args[0], src = args[1]; - var realPath = GetRealPath(src); - console.log('media::create() - id =' + id + ', src =' + realPath); + console.log('media::create() - id =' + id + ', src =' + src); - recorder = new Recorder(realPath); + recorder = new Recorder(src); audioObjects[id] = new Audio(); audioObjects[id].isReady = false; @@ -324,8 +304,7 @@ cordova.define(plugin_name, function(require, exports, module) { startPlayingAudio: function(successCallback, errorCallback, args) { var id = args[0], src = args[1]; - var realPath = GetRealPath(src); - console.log('media::startPlayingAudio() - id =' + id + ', src =' + realPath); + console.log('media::startPlayingAudio() - id =' + id + ', src =' + src); audioObjects[id].isReady = true; @@ -335,7 +314,7 @@ cordova.define(plugin_name, function(require, exports, module) { //it should be saved and restored. var rate = audioObjects[id].playbackRate; - audioObjects[id].src = realPath; + audioObjects[id].src = src; audioObjects[id].playbackRate = rate; return; } @@ -387,7 +366,7 @@ cordova.define(plugin_name, function(require, exports, module) { var id = args[0]; console.log('media::getCurrentPositionAudio()'); if (audioObjects[id].src === 'undefined') { - audioObjects[id].src = GetRealPath(args[1]); + audioObjects[id].src = args[1]; } successCallback(audioObjects[id].currentTime); }, @@ -395,7 +374,7 @@ cordova.define(plugin_name, function(require, exports, module) { var id = args[0]; console.log('media::startRecordingAudio()'); if (audioObjects[id].src === 'undefined') { - audioObjects[id].src = GetRealPath(args[1]); + audioObjects[id].src = args[1]; } recorder.rec(); }, @@ -403,7 +382,7 @@ cordova.define(plugin_name, function(require, exports, module) { var id = args[0]; console.log('media::stopRecordingAudio()'); if (audioObjects[id].src === 'undefined') { - audioObjects[id].src = GetRealPath(args[1]); + audioObjects[id].src = args[1]; } recorder.stop(); }, diff --git a/src/media/cordova_media_extension.cc b/src/media/cordova_media_extension.cc index 98462f1..6565afc 100755 --- a/src/media/cordova_media_extension.cc +++ b/src/media/cordova_media_extension.cc @@ -15,7 +15,6 @@ */ #include "media/cordova_media_extension.h" -#include "media/cordova_media_instance.h" // This will be generated from cordova_media_api.js extern const char kSource_cordova_media_api[]; @@ -35,11 +34,6 @@ CordovaMediaExtension::CordovaMediaExtension() { CordovaMediaExtension::~CordovaMediaExtension() {} -common::Instance* CordovaMediaExtension::CreateInstance() { - LoggerD("Entered"); - return new extension::cordova::media::CordovaMediaInstance(); -} - } // media } // cordova } // extension diff --git a/src/media/cordova_media_extension.h b/src/media/cordova_media_extension.h index 9575086..3db047c 100755 --- a/src/media/cordova_media_extension.h +++ b/src/media/cordova_media_extension.h @@ -27,10 +27,6 @@ class CordovaMediaExtension : public common::Extension { public: CordovaMediaExtension(); virtual ~CordovaMediaExtension(); - - private: - // common::Extension implementation. - virtual common::Instance* CreateInstance(); }; } //media diff --git a/src/media/cordova_media_instance.cc b/src/media/cordova_media_instance.cc deleted file mode 100644 index 6fe8c71..0000000 --- a/src/media/cordova_media_instance.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "media/cordova_media_instance.h" -#include - -namespace extension { -namespace cordova { -namespace media { - -CordovaMediaInstance::CordovaMediaInstance(): fs_provider_(common::FilesystemProviderStorage::Create()) { - LoggerD("Entered"); - - RegisterSyncHandler("CordovaMediaInstance_GetRealPath", - std::bind(&CordovaMediaInstance::GetRealPath, this, std::placeholders::_1, std::placeholders::_2)); - -} - -CordovaMediaInstance::~CordovaMediaInstance() { -} - -void CordovaMediaInstance::GetRealPath(const picojson::value& args, picojson::object& out) { - LoggerD("Entered"); - - const std::string& path_str = args.get("path").get(); - - picojson::value retval = picojson::value(picojson::object()); - picojson::object& obj = retval.get(); - - LoggerD("Path is %s", path_str.c_str()); - std::string realPath = fs_provider_.GetRealPath(path_str); - obj["path"] = picojson::value(realPath); - LoggerD("Real Path is %s", realPath.c_str()); - ReportSuccess(retval,out); -} - -} -} -} /* namespace media */ diff --git a/src/media/cordova_media_instance.h b/src/media/cordova_media_instance.h deleted file mode 100644 index ba6e23f..0000000 --- a/src/media/cordova_media_instance.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MEDIA_CORDOVA_MEDIA_EXTENSION_H_ -#define MEDIA_CORDOVA_MEDIA_EXTENSION_H_ - -#include -#include -#include - -namespace extension { -namespace cordova { -namespace media { - -class CordovaMediaInstance : public common::ParsedInstance { - public: - CordovaMediaInstance(); - virtual ~CordovaMediaInstance(); - - private: - common::FilesystemProviderStorage& fs_provider_; - void GetRealPath(const picojson::value& args, picojson::object& out); -}; - -} -} -} /* namespace media */ - -#endif // MEDIA_CORDOVA_MEDIA_EXTENSION_H_