[common][cordova][update all the cordova plugins to the latest] 14/179214/1
authorlin qunfang <qunfang.lin@samsung.com>
Wed, 16 May 2018 20:01:45 +0000 (04:01 +0800)
committerlin qunfang <qunfang.lin@samsung.com>
Wed, 16 May 2018 20:02:02 +0000 (04:02 +0800)
Change-Id: I2995fc977b4274ce08dd0c2f201bd1d48382bfa0
Signed-off-by: lin qunfang <qunfang.lin@samsung.com>
488 files changed:
common/tct-device-cordova-tests/cordova/cordova-5.1.1.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/cordova.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/cordova_plugins.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-console/www/console-via-logger.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-console/www/logger.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/Acceleration.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/accelerometer.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-device/www/device.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-dialogs/www/notification.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-events/www/register.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransfer.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransferError.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryReader.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Entry.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Errors.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/File.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileReader.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileSystem.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileWriter.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/requestFileSystem.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/rootUtils.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryReader.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/Entry.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/File.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileEntry.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileError.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileReader.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileSystem.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadOptions.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadResult.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileWriter.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/Flags.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/LocalFileSystem.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/Metadata.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/ProgressEvent.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/requestFileSystem.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/GlobalizationError.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/globalization.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-media/tizen/Media.js
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-media/www/Media.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-media/www/MediaError.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/Connection.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/NetworkStatus.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/Connection.js [changed mode: 0755->0644]
common/tct-device-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/network.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/cordova-5.1.1.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/cordova.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/cordova_plugins.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-console/www/console-via-logger.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-console/www/logger.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/Acceleration.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/accelerometer.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-device/www/device.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-dialogs/www/notification.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-events/www/register.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransfer.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransferError.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryReader.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Entry.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Errors.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/File.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileReader.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileSystem.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileWriter.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/requestFileSystem.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/rootUtils.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryReader.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/Entry.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/File.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileEntry.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileError.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileReader.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileSystem.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadOptions.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadResult.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileWriter.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/Flags.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/LocalFileSystem.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/Metadata.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/ProgressEvent.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/requestFileSystem.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/GlobalizationError.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/globalization.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-media/tizen/Media.js
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-media/www/Media.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-media/www/MediaError.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/Connection.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/NetworkStatus.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/Connection.js [changed mode: 0755->0644]
common/tct-devicemotion-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/network.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/cordova-5.1.1.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/cordova.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/cordova_plugins.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-console/www/console-via-logger.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-console/www/logger.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/Acceleration.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/accelerometer.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-device/www/device.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-dialogs/www/notification.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-events/www/register.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransfer.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransferError.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryReader.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Entry.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Errors.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/File.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileReader.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileSystem.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileWriter.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/requestFileSystem.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/rootUtils.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryReader.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/Entry.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/File.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileEntry.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileError.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileReader.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileSystem.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadOptions.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadResult.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileWriter.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/Flags.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/LocalFileSystem.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/Metadata.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/ProgressEvent.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/requestFileSystem.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/GlobalizationError.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/globalization.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-media/tizen/Media.js
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-media/www/Media.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-media/www/MediaError.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/Connection.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/NetworkStatus.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/Connection.js [changed mode: 0755->0644]
common/tct-dialogs-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/network.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/cordova-5.1.1.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/cordova.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/cordova_plugins.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-console/www/console-via-logger.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-console/www/logger.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/Acceleration.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/accelerometer.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-device/www/device.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-dialogs/tizen/Notification.js
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-dialogs/www/notification.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-events/www/register.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransfer.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransferError.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryReader.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Entry.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Errors.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/File.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileReader.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileSystem.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileWriter.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/requestFileSystem.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/rootUtils.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryReader.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/Entry.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/File.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileEntry.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileError.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileReader.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileSystem.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadOptions.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadResult.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileWriter.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/Flags.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/LocalFileSystem.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/Metadata.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/ProgressEvent.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/requestFileSystem.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-globalization/tizen/Globalization.js
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/GlobalizationError.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/globalization.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-media/tizen/Media.js
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-media/www/Media.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-media/www/MediaError.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/Connection.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/NetworkStatus.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/Connection.js [changed mode: 0755->0644]
common/tct-events-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/network.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/cordova-5.1.1.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/cordova.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/cordova_plugins.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-console/www/console-via-logger.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-console/www/logger.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/Acceleration.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/accelerometer.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-device/www/device.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-dialogs/www/notification.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-events/www/register.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransfer.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransferError.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryReader.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Entry.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Errors.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/File.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileReader.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileSystem.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileWriter.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/requestFileSystem.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/rootUtils.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryReader.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/Entry.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/File.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileEntry.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileError.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileReader.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileSystem.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadOptions.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadResult.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileWriter.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/Flags.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/LocalFileSystem.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/Metadata.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/ProgressEvent.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/requestFileSystem.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/GlobalizationError.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/globalization.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-media/tizen/Media.js
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-media/www/Media.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-media/www/MediaError.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/Connection.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/NetworkStatus.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/Connection.js [changed mode: 0755->0644]
common/tct-file-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/network.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/cordova-5.1.1.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/cordova.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/cordova_plugins.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-console/www/console-via-logger.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-console/www/logger.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/Acceleration.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/accelerometer.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-device/www/device.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-dialogs/www/notification.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-events/www/register.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransfer.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransferError.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryReader.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Entry.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Errors.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/File.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileReader.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileSystem.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileWriter.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/requestFileSystem.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/rootUtils.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryReader.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/Entry.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/File.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileEntry.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileError.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileReader.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileSystem.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadOptions.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadResult.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileWriter.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/Flags.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/LocalFileSystem.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/Metadata.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/ProgressEvent.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/requestFileSystem.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/GlobalizationError.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/globalization.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-media/tizen/Media.js
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-media/www/Media.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-media/www/MediaError.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/Connection.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/NetworkStatus.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/Connection.js [changed mode: 0755->0644]
common/tct-file-transfer-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/network.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/cordova-5.1.1.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/cordova.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/cordova_plugins.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-console/www/console-via-logger.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-console/www/logger.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/Acceleration.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/accelerometer.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-device/www/device.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-dialogs/www/notification.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-events/www/register.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransfer.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransferError.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryReader.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Entry.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Errors.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/File.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileReader.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileSystem.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileWriter.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/requestFileSystem.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/rootUtils.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryReader.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/Entry.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/File.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileEntry.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileError.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileReader.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileSystem.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadOptions.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadResult.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileWriter.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/Flags.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/LocalFileSystem.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/Metadata.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/ProgressEvent.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/requestFileSystem.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/GlobalizationError.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/globalization.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-media/tizen/Media.js
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-media/www/Media.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-media/www/MediaError.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/Connection.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/NetworkStatus.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/Connection.js [changed mode: 0755->0644]
common/tct-globalization-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/network.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/cordova-5.1.1.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/cordova.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/cordova_plugins.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-console/www/console-via-logger.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-console/www/logger.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/Acceleration.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/accelerometer.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-device/www/device.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-dialogs/www/notification.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-events/www/register.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransfer.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransferError.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryReader.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Entry.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Errors.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/File.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileReader.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileSystem.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileWriter.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/requestFileSystem.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/rootUtils.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryReader.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/Entry.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/File.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileEntry.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileError.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileReader.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileSystem.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadOptions.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadResult.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileWriter.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/Flags.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/LocalFileSystem.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/Metadata.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/ProgressEvent.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/requestFileSystem.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/GlobalizationError.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/globalization.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-media/tizen/Media.js
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-media/www/Media.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-media/www/MediaError.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/Connection.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/NetworkStatus.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/Connection.js [changed mode: 0755->0644]
common/tct-media-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/network.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/cordova-5.1.1.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/cordova.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/cordova_plugins.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-console/www/console-via-logger.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-console/www/logger.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/Acceleration.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-device-motion/www/accelerometer.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-device/www/device.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-dialogs/www/notification.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-events/www/register.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransfer.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file-transfer/www/FileTransferError.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/DirectoryReader.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Entry.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/Errors.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/File.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileReader.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileSystem.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/FileWriter.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/requestFileSystem.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/tizen/rootUtils.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryEntry.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/DirectoryReader.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/Entry.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/File.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileEntry.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileError.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileReader.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileSystem.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadOptions.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileUploadResult.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/FileWriter.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/Flags.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/LocalFileSystem.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/Metadata.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/ProgressEvent.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystemPaths.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems-roots.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/fileSystems.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/requestFileSystem.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/GlobalizationError.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-globalization/www/globalization.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-media/tizen/Media.js
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-media/www/Media.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-media/www/MediaError.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/Connection.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-network-information/tizen/NetworkStatus.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/Connection.js [changed mode: 0755->0644]
common/tct-network-information-cordova-tests/cordova/plugins/cordova-plugin-network-information/www/network.js [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 9331997..45b8e79
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-dialogs.notification", function(require, exports,
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec');
old mode 100755 (executable)
new mode 100644 (file)
index e592166..c344315
@@ -21,7 +21,13 @@ cordova.define('cordova-plugin-file.tizen.FileWriter', function(require, exports
 var convertTizenFileError = require('cordova-plugin-file.tizen.Errors');
 var rootUtils = require('cordova-plugin-file.tizen.rootUtils');
 
-// https://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
+//Code created with the help of Stack Overflow question
+//http://stackoverflow.com/a/18729931
+//Question by don kaka:
+//https://stackoverflow.com/users/2408835/don-kaka
+//Answer by Joni and Damian:
+//https://stackoverflow.com/users/318758/joni
+//https://stackoverflow.com/users/3390/damian
 function toUTF8Array(str) {
   var utf8 = [];
   for (var i = 0; i < str.length; ++i) {
old mode 100755 (executable)
new mode 100644 (file)
index 187d111..9dee943
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-file.fileSystems-roots", function(require, export
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 // Map of fsName -> FileSystem.
index 0f29b19becb228858ffe8d337f31f0913a077eaf..9dff36b12dd596c92c80cd9fbc5c74830a068c1d 100755 (executable)
@@ -19,6 +19,19 @@ var plugin_name = 'cordova-plugin-media.tizen.Media';
 
 cordova.define(plugin_name, function(require, exports, module) {
 // TODO: remove -> end
+    function MediaError (code, msg) {
+        Object.defineProperties(this, {
+            code: {
+                value: code || null,
+                writable: false
+            },
+            message: {
+                value: msg || "",
+                writable: false
+            }
+        });
+    }
+    Object.assign(MediaError, window.MediaError);
 
     var audioObjects = {};
     var recorder = null;
@@ -27,7 +40,7 @@ cordova.define(plugin_name, function(require, exports, module) {
     var audioContext = window.AudioContext || window.webkitAudioContext;
     var context = new audioContext();
 
-    function Recorder(_filename) {
+    function Recorder(_filename, _errorCallback) {
         var recorder = null;
         var recording = false;
         var recordingLength = 0;
@@ -36,25 +49,38 @@ cordova.define(plugin_name, function(require, exports, module) {
         var sampleRate = null;
         var filename = _filename;
         var audioBlob = null;
+        var leftchannel;
+        var rightchannel;
+        var errorCallback = _errorCallback;
 
         this.rec = function(){
-
-            if (!navigator.getUserMedia)
+            if (navigator.mediaDevices.getUserMedia){
+                navigator.mediaDevices.getUserMedia({audio:true})
+                  .then(onGetUserMedia)
+                  .catch(function(e) {
+                       console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                   });
+            } else {
                 navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia ||
                     navigator.mozGetUserMedia || navigator.msGetUserMedia;
-
-            if (navigator.getUserMedia){
-                navigator.getUserMedia({audio:true}, onGetUserMedia, function(e) {
-                    console.log('Error capturing audio.');
-                });
-            } else {
-                console.log('getUserMedia not supported in this browser.');
+                if(navigator.getUserMedia) {
+                    navigator.getUserMedia({audio: true}, onGetUserMedia, function(e) {
+                        console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                    })
+                } else {
+                    console.log('getUserMedia not supported in this browser.');
+                }
             }
         }
 
         this.stop = function (){
             recording = false;
-            audioBlob.stop();
+            var tracks = audioBlob.getAudioTracks();
+
+            tracks.forEach(function(track) {
+                track.stop();
+            });
+
             recorder.disconnect();
 
             // flat the left and right channels down
@@ -100,8 +126,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
         function onGetUserMedia(stream){
             recording = true;
-            var leftchannel = [];
-            var rightchannel = [];
             recordingLength = 0;
 
             audioBlob = stream;
@@ -123,8 +147,10 @@ cordova.define(plugin_name, function(require, exports, module) {
              Lower values for buffer size will result in a lower (better) latency.
              Higher values will be necessary to avoid audio breakup and glitches */
             var bufferSize = 2048;
-            recorder = context.createJavaScriptNode(bufferSize, 2, 2);
+            recorder = context.createScriptProcessor(bufferSize, 2, 2);
 
+            rightchannel = [];
+            leftchannel = [];
             recorder.onaudioprocess = function(sample){
                 if (!recording) {
                     return;
@@ -150,26 +176,39 @@ cordova.define(plugin_name, function(require, exports, module) {
             }
 
             function onsuccess(dir) {
-                var recFile = dir.createFile(filename);
-                if (recFile != null) {
-                    recFile.openStream('w', function (fs) {
-                        fs.writeBytes(arr);
-                        fs.close();
-                    }, function (error) {
-                        console.log('Error ' + error.message);
-                    }, 'UTF-8');
+                var recFile
+                try {
+                    recFile = dir.createFile(filename);
+                    if (recFile != null) {
+                        recFile.openStream('w', function (fs) {
+                            try {
+                                fs.writeBytes(arr);
+                                fs.close();
+                            } catch (error) {
+                                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                            }
+                        }, function (error) {
+                            console.log('Failed to open stream error: ' + error.message);
+                            errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                        }, 'UTF-8');
+                    }
+                } catch (error) {
+                    console.log('Error during saving record to file');
+                    errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
                 }
             }
 
             function onerror(error) {
                 console.log('The error ' + error + ' occurred when resolving documents folder');
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
 
             try {
                 tizen.filesystem.resolve('documents', onsuccess, onerror, 'rw');
             }
             catch(error) {
-                console.log('Caught error ' + error);
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
         }
 
@@ -213,7 +252,10 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     console.log('media::create() - id =' + id + ', src =' + src);
 
-    recorder = new Recorder(src);
+    recorder = new Recorder(src, function(error) {
+        console.log('Recorder error callback');
+        Media.onStatus(id, Media.MEDIA_ERROR, error);
+    });
     audioObjects[id] = new Audio();
     audioObjects[id].isReady = false;
 
@@ -243,16 +285,12 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     audioObjects[id].onErrorCB = function (event) {
         var err = event.srcElement.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED ?
-            { code: MediaError.MEDIA_ERR_ABORTED } :
+            new MediaError(MediaError.MEDIA_ERR_ABORTED) :
             event.srcElement.error;
-        Object.freeze(err);
 
         console.log('media::onErrorCB() - MEDIA_ERROR -> ' + err);
 
         Media.onStatus(id, Media.MEDIA_ERROR, err);
-        if (errorCallback) {
-            errorCallback(err);
-        }
     };
 
     audioObjects[id].onPlayCB = function () {
@@ -313,14 +351,37 @@ cordova.define(plugin_name, function(require, exports, module) {
     audioObjects[id].isReady = true;
 
     if (!audioObjects[id].src) {
-      //assigning src sets playbackRate to default value equal to 1
-      //so if playbackRate was set before first run of play() function
-      //it should be saved and restored.
-      var rate = audioObjects[id].playbackRate;
+        var setSrc = function(id, src) {
+            //assigning src sets playbackRate to default value equal to 1
+            //so if playbackRate was set before first run of play() function
+            //it should be saved and restored.
+            var rate = audioObjects[id].playbackRate;
+
+            audioObjects[id].src = src;
+            audioObjects[id].playbackRate = rate;
+        };
+
+        if(RegExp('^((file\:\/\/)|(/)).*').test(src)) {
+            setSrc(id,src);
+            return;
+        }
 
-      audioObjects[id].src = src;
-      audioObjects[id].playbackRate = rate;
-      return;
+        if(!RegExp('.*!(\/\/).*').test(src)) {
+            try {
+                tizen.filesystem.resolve('documents', function(dir) {
+                    setSrc(id, dir.toURI() + '/' + src);
+                }, function(error) {
+                    console.log('Documents filesystem resolve failed');
+                    Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                }, 'r');
+            } catch (error) {
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+            }
+            return;
+        } else {
+            setSrc(id, src);
+        }
     }
 
     audioObjects[id].play();
@@ -338,16 +399,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
       console.log('media::stopPlayingAudio() - MEDIA_STATE -> MEDIA_STOPPED');
 
-      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
-      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
-      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
-      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
-      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
-      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
-      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
-
       Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
   },
   seekToAudio: function(successCallback, errorCallback, args) {
@@ -369,30 +420,35 @@ cordova.define(plugin_name, function(require, exports, module) {
   getCurrentPositionAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::getCurrentPositionAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       successCallback(audioObjects[id].currentTime);
   },
   startRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::startRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.rec();
   },
   stopRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::stopRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.stop();
   },
   release: function(successCallback, errorCallback, args) {
       exports.stopPlayingAudio(successCallback, errorCallback, args);
       var id = args[0];
+
+      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
+      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
+      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
+      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
+      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
+      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
+      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
+
       delete audioObjects[id];
       console.log('media::release()');
   },
old mode 100755 (executable)
new mode 100644 (file)
index 3378253..7e3199b
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.Media", function(require, exports, module)
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var argscheck = require('cordova/argscheck'),
old mode 100755 (executable)
new mode 100644 (file)
index 79b65f6..de998a5
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.MediaError", function(require, exports, mod
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index 1450e95..b8412e5
@@ -16,7 +16,7 @@ cordova.define("cordova-plugin-network-information.Connection", function(require
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index bfac2e3..206a8f7
@@ -16,6 +16,7 @@ cordova.define("cordova-plugin-network-information.network", function(require, e
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec'),
old mode 100755 (executable)
new mode 100644 (file)
index 9331997..45b8e79
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-dialogs.notification", function(require, exports,
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec');
old mode 100755 (executable)
new mode 100644 (file)
index e592166..c344315
@@ -21,7 +21,13 @@ cordova.define('cordova-plugin-file.tizen.FileWriter', function(require, exports
 var convertTizenFileError = require('cordova-plugin-file.tizen.Errors');
 var rootUtils = require('cordova-plugin-file.tizen.rootUtils');
 
-// https://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
+//Code created with the help of Stack Overflow question
+//http://stackoverflow.com/a/18729931
+//Question by don kaka:
+//https://stackoverflow.com/users/2408835/don-kaka
+//Answer by Joni and Damian:
+//https://stackoverflow.com/users/318758/joni
+//https://stackoverflow.com/users/3390/damian
 function toUTF8Array(str) {
   var utf8 = [];
   for (var i = 0; i < str.length; ++i) {
old mode 100755 (executable)
new mode 100644 (file)
index 187d111..9dee943
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-file.fileSystems-roots", function(require, export
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 // Map of fsName -> FileSystem.
index 0f29b19becb228858ffe8d337f31f0913a077eaf..9dff36b12dd596c92c80cd9fbc5c74830a068c1d 100755 (executable)
@@ -19,6 +19,19 @@ var plugin_name = 'cordova-plugin-media.tizen.Media';
 
 cordova.define(plugin_name, function(require, exports, module) {
 // TODO: remove -> end
+    function MediaError (code, msg) {
+        Object.defineProperties(this, {
+            code: {
+                value: code || null,
+                writable: false
+            },
+            message: {
+                value: msg || "",
+                writable: false
+            }
+        });
+    }
+    Object.assign(MediaError, window.MediaError);
 
     var audioObjects = {};
     var recorder = null;
@@ -27,7 +40,7 @@ cordova.define(plugin_name, function(require, exports, module) {
     var audioContext = window.AudioContext || window.webkitAudioContext;
     var context = new audioContext();
 
-    function Recorder(_filename) {
+    function Recorder(_filename, _errorCallback) {
         var recorder = null;
         var recording = false;
         var recordingLength = 0;
@@ -36,25 +49,38 @@ cordova.define(plugin_name, function(require, exports, module) {
         var sampleRate = null;
         var filename = _filename;
         var audioBlob = null;
+        var leftchannel;
+        var rightchannel;
+        var errorCallback = _errorCallback;
 
         this.rec = function(){
-
-            if (!navigator.getUserMedia)
+            if (navigator.mediaDevices.getUserMedia){
+                navigator.mediaDevices.getUserMedia({audio:true})
+                  .then(onGetUserMedia)
+                  .catch(function(e) {
+                       console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                   });
+            } else {
                 navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia ||
                     navigator.mozGetUserMedia || navigator.msGetUserMedia;
-
-            if (navigator.getUserMedia){
-                navigator.getUserMedia({audio:true}, onGetUserMedia, function(e) {
-                    console.log('Error capturing audio.');
-                });
-            } else {
-                console.log('getUserMedia not supported in this browser.');
+                if(navigator.getUserMedia) {
+                    navigator.getUserMedia({audio: true}, onGetUserMedia, function(e) {
+                        console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                    })
+                } else {
+                    console.log('getUserMedia not supported in this browser.');
+                }
             }
         }
 
         this.stop = function (){
             recording = false;
-            audioBlob.stop();
+            var tracks = audioBlob.getAudioTracks();
+
+            tracks.forEach(function(track) {
+                track.stop();
+            });
+
             recorder.disconnect();
 
             // flat the left and right channels down
@@ -100,8 +126,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
         function onGetUserMedia(stream){
             recording = true;
-            var leftchannel = [];
-            var rightchannel = [];
             recordingLength = 0;
 
             audioBlob = stream;
@@ -123,8 +147,10 @@ cordova.define(plugin_name, function(require, exports, module) {
              Lower values for buffer size will result in a lower (better) latency.
              Higher values will be necessary to avoid audio breakup and glitches */
             var bufferSize = 2048;
-            recorder = context.createJavaScriptNode(bufferSize, 2, 2);
+            recorder = context.createScriptProcessor(bufferSize, 2, 2);
 
+            rightchannel = [];
+            leftchannel = [];
             recorder.onaudioprocess = function(sample){
                 if (!recording) {
                     return;
@@ -150,26 +176,39 @@ cordova.define(plugin_name, function(require, exports, module) {
             }
 
             function onsuccess(dir) {
-                var recFile = dir.createFile(filename);
-                if (recFile != null) {
-                    recFile.openStream('w', function (fs) {
-                        fs.writeBytes(arr);
-                        fs.close();
-                    }, function (error) {
-                        console.log('Error ' + error.message);
-                    }, 'UTF-8');
+                var recFile
+                try {
+                    recFile = dir.createFile(filename);
+                    if (recFile != null) {
+                        recFile.openStream('w', function (fs) {
+                            try {
+                                fs.writeBytes(arr);
+                                fs.close();
+                            } catch (error) {
+                                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                            }
+                        }, function (error) {
+                            console.log('Failed to open stream error: ' + error.message);
+                            errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                        }, 'UTF-8');
+                    }
+                } catch (error) {
+                    console.log('Error during saving record to file');
+                    errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
                 }
             }
 
             function onerror(error) {
                 console.log('The error ' + error + ' occurred when resolving documents folder');
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
 
             try {
                 tizen.filesystem.resolve('documents', onsuccess, onerror, 'rw');
             }
             catch(error) {
-                console.log('Caught error ' + error);
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
         }
 
@@ -213,7 +252,10 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     console.log('media::create() - id =' + id + ', src =' + src);
 
-    recorder = new Recorder(src);
+    recorder = new Recorder(src, function(error) {
+        console.log('Recorder error callback');
+        Media.onStatus(id, Media.MEDIA_ERROR, error);
+    });
     audioObjects[id] = new Audio();
     audioObjects[id].isReady = false;
 
@@ -243,16 +285,12 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     audioObjects[id].onErrorCB = function (event) {
         var err = event.srcElement.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED ?
-            { code: MediaError.MEDIA_ERR_ABORTED } :
+            new MediaError(MediaError.MEDIA_ERR_ABORTED) :
             event.srcElement.error;
-        Object.freeze(err);
 
         console.log('media::onErrorCB() - MEDIA_ERROR -> ' + err);
 
         Media.onStatus(id, Media.MEDIA_ERROR, err);
-        if (errorCallback) {
-            errorCallback(err);
-        }
     };
 
     audioObjects[id].onPlayCB = function () {
@@ -313,14 +351,37 @@ cordova.define(plugin_name, function(require, exports, module) {
     audioObjects[id].isReady = true;
 
     if (!audioObjects[id].src) {
-      //assigning src sets playbackRate to default value equal to 1
-      //so if playbackRate was set before first run of play() function
-      //it should be saved and restored.
-      var rate = audioObjects[id].playbackRate;
+        var setSrc = function(id, src) {
+            //assigning src sets playbackRate to default value equal to 1
+            //so if playbackRate was set before first run of play() function
+            //it should be saved and restored.
+            var rate = audioObjects[id].playbackRate;
+
+            audioObjects[id].src = src;
+            audioObjects[id].playbackRate = rate;
+        };
+
+        if(RegExp('^((file\:\/\/)|(/)).*').test(src)) {
+            setSrc(id,src);
+            return;
+        }
 
-      audioObjects[id].src = src;
-      audioObjects[id].playbackRate = rate;
-      return;
+        if(!RegExp('.*!(\/\/).*').test(src)) {
+            try {
+                tizen.filesystem.resolve('documents', function(dir) {
+                    setSrc(id, dir.toURI() + '/' + src);
+                }, function(error) {
+                    console.log('Documents filesystem resolve failed');
+                    Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                }, 'r');
+            } catch (error) {
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+            }
+            return;
+        } else {
+            setSrc(id, src);
+        }
     }
 
     audioObjects[id].play();
@@ -338,16 +399,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
       console.log('media::stopPlayingAudio() - MEDIA_STATE -> MEDIA_STOPPED');
 
-      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
-      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
-      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
-      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
-      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
-      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
-      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
-
       Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
   },
   seekToAudio: function(successCallback, errorCallback, args) {
@@ -369,30 +420,35 @@ cordova.define(plugin_name, function(require, exports, module) {
   getCurrentPositionAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::getCurrentPositionAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       successCallback(audioObjects[id].currentTime);
   },
   startRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::startRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.rec();
   },
   stopRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::stopRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.stop();
   },
   release: function(successCallback, errorCallback, args) {
       exports.stopPlayingAudio(successCallback, errorCallback, args);
       var id = args[0];
+
+      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
+      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
+      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
+      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
+      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
+      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
+      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
+
       delete audioObjects[id];
       console.log('media::release()');
   },
old mode 100755 (executable)
new mode 100644 (file)
index 3378253..7e3199b
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.Media", function(require, exports, module)
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var argscheck = require('cordova/argscheck'),
old mode 100755 (executable)
new mode 100644 (file)
index 79b65f6..de998a5
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.MediaError", function(require, exports, mod
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index 1450e95..b8412e5
@@ -16,7 +16,7 @@ cordova.define("cordova-plugin-network-information.Connection", function(require
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index bfac2e3..206a8f7
@@ -16,6 +16,7 @@ cordova.define("cordova-plugin-network-information.network", function(require, e
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec'),
old mode 100755 (executable)
new mode 100644 (file)
index 9331997..45b8e79
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-dialogs.notification", function(require, exports,
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec');
old mode 100755 (executable)
new mode 100644 (file)
index e592166..c344315
@@ -21,7 +21,13 @@ cordova.define('cordova-plugin-file.tizen.FileWriter', function(require, exports
 var convertTizenFileError = require('cordova-plugin-file.tizen.Errors');
 var rootUtils = require('cordova-plugin-file.tizen.rootUtils');
 
-// https://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
+//Code created with the help of Stack Overflow question
+//http://stackoverflow.com/a/18729931
+//Question by don kaka:
+//https://stackoverflow.com/users/2408835/don-kaka
+//Answer by Joni and Damian:
+//https://stackoverflow.com/users/318758/joni
+//https://stackoverflow.com/users/3390/damian
 function toUTF8Array(str) {
   var utf8 = [];
   for (var i = 0; i < str.length; ++i) {
old mode 100755 (executable)
new mode 100644 (file)
index 187d111..9dee943
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-file.fileSystems-roots", function(require, export
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 // Map of fsName -> FileSystem.
index 0f29b19becb228858ffe8d337f31f0913a077eaf..9dff36b12dd596c92c80cd9fbc5c74830a068c1d 100755 (executable)
@@ -19,6 +19,19 @@ var plugin_name = 'cordova-plugin-media.tizen.Media';
 
 cordova.define(plugin_name, function(require, exports, module) {
 // TODO: remove -> end
+    function MediaError (code, msg) {
+        Object.defineProperties(this, {
+            code: {
+                value: code || null,
+                writable: false
+            },
+            message: {
+                value: msg || "",
+                writable: false
+            }
+        });
+    }
+    Object.assign(MediaError, window.MediaError);
 
     var audioObjects = {};
     var recorder = null;
@@ -27,7 +40,7 @@ cordova.define(plugin_name, function(require, exports, module) {
     var audioContext = window.AudioContext || window.webkitAudioContext;
     var context = new audioContext();
 
-    function Recorder(_filename) {
+    function Recorder(_filename, _errorCallback) {
         var recorder = null;
         var recording = false;
         var recordingLength = 0;
@@ -36,25 +49,38 @@ cordova.define(plugin_name, function(require, exports, module) {
         var sampleRate = null;
         var filename = _filename;
         var audioBlob = null;
+        var leftchannel;
+        var rightchannel;
+        var errorCallback = _errorCallback;
 
         this.rec = function(){
-
-            if (!navigator.getUserMedia)
+            if (navigator.mediaDevices.getUserMedia){
+                navigator.mediaDevices.getUserMedia({audio:true})
+                  .then(onGetUserMedia)
+                  .catch(function(e) {
+                       console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                   });
+            } else {
                 navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia ||
                     navigator.mozGetUserMedia || navigator.msGetUserMedia;
-
-            if (navigator.getUserMedia){
-                navigator.getUserMedia({audio:true}, onGetUserMedia, function(e) {
-                    console.log('Error capturing audio.');
-                });
-            } else {
-                console.log('getUserMedia not supported in this browser.');
+                if(navigator.getUserMedia) {
+                    navigator.getUserMedia({audio: true}, onGetUserMedia, function(e) {
+                        console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                    })
+                } else {
+                    console.log('getUserMedia not supported in this browser.');
+                }
             }
         }
 
         this.stop = function (){
             recording = false;
-            audioBlob.stop();
+            var tracks = audioBlob.getAudioTracks();
+
+            tracks.forEach(function(track) {
+                track.stop();
+            });
+
             recorder.disconnect();
 
             // flat the left and right channels down
@@ -100,8 +126,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
         function onGetUserMedia(stream){
             recording = true;
-            var leftchannel = [];
-            var rightchannel = [];
             recordingLength = 0;
 
             audioBlob = stream;
@@ -123,8 +147,10 @@ cordova.define(plugin_name, function(require, exports, module) {
              Lower values for buffer size will result in a lower (better) latency.
              Higher values will be necessary to avoid audio breakup and glitches */
             var bufferSize = 2048;
-            recorder = context.createJavaScriptNode(bufferSize, 2, 2);
+            recorder = context.createScriptProcessor(bufferSize, 2, 2);
 
+            rightchannel = [];
+            leftchannel = [];
             recorder.onaudioprocess = function(sample){
                 if (!recording) {
                     return;
@@ -150,26 +176,39 @@ cordova.define(plugin_name, function(require, exports, module) {
             }
 
             function onsuccess(dir) {
-                var recFile = dir.createFile(filename);
-                if (recFile != null) {
-                    recFile.openStream('w', function (fs) {
-                        fs.writeBytes(arr);
-                        fs.close();
-                    }, function (error) {
-                        console.log('Error ' + error.message);
-                    }, 'UTF-8');
+                var recFile
+                try {
+                    recFile = dir.createFile(filename);
+                    if (recFile != null) {
+                        recFile.openStream('w', function (fs) {
+                            try {
+                                fs.writeBytes(arr);
+                                fs.close();
+                            } catch (error) {
+                                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                            }
+                        }, function (error) {
+                            console.log('Failed to open stream error: ' + error.message);
+                            errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                        }, 'UTF-8');
+                    }
+                } catch (error) {
+                    console.log('Error during saving record to file');
+                    errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
                 }
             }
 
             function onerror(error) {
                 console.log('The error ' + error + ' occurred when resolving documents folder');
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
 
             try {
                 tizen.filesystem.resolve('documents', onsuccess, onerror, 'rw');
             }
             catch(error) {
-                console.log('Caught error ' + error);
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
         }
 
@@ -213,7 +252,10 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     console.log('media::create() - id =' + id + ', src =' + src);
 
-    recorder = new Recorder(src);
+    recorder = new Recorder(src, function(error) {
+        console.log('Recorder error callback');
+        Media.onStatus(id, Media.MEDIA_ERROR, error);
+    });
     audioObjects[id] = new Audio();
     audioObjects[id].isReady = false;
 
@@ -243,16 +285,12 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     audioObjects[id].onErrorCB = function (event) {
         var err = event.srcElement.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED ?
-            { code: MediaError.MEDIA_ERR_ABORTED } :
+            new MediaError(MediaError.MEDIA_ERR_ABORTED) :
             event.srcElement.error;
-        Object.freeze(err);
 
         console.log('media::onErrorCB() - MEDIA_ERROR -> ' + err);
 
         Media.onStatus(id, Media.MEDIA_ERROR, err);
-        if (errorCallback) {
-            errorCallback(err);
-        }
     };
 
     audioObjects[id].onPlayCB = function () {
@@ -313,14 +351,37 @@ cordova.define(plugin_name, function(require, exports, module) {
     audioObjects[id].isReady = true;
 
     if (!audioObjects[id].src) {
-      //assigning src sets playbackRate to default value equal to 1
-      //so if playbackRate was set before first run of play() function
-      //it should be saved and restored.
-      var rate = audioObjects[id].playbackRate;
+        var setSrc = function(id, src) {
+            //assigning src sets playbackRate to default value equal to 1
+            //so if playbackRate was set before first run of play() function
+            //it should be saved and restored.
+            var rate = audioObjects[id].playbackRate;
+
+            audioObjects[id].src = src;
+            audioObjects[id].playbackRate = rate;
+        };
+
+        if(RegExp('^((file\:\/\/)|(/)).*').test(src)) {
+            setSrc(id,src);
+            return;
+        }
 
-      audioObjects[id].src = src;
-      audioObjects[id].playbackRate = rate;
-      return;
+        if(!RegExp('.*!(\/\/).*').test(src)) {
+            try {
+                tizen.filesystem.resolve('documents', function(dir) {
+                    setSrc(id, dir.toURI() + '/' + src);
+                }, function(error) {
+                    console.log('Documents filesystem resolve failed');
+                    Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                }, 'r');
+            } catch (error) {
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+            }
+            return;
+        } else {
+            setSrc(id, src);
+        }
     }
 
     audioObjects[id].play();
@@ -338,16 +399,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
       console.log('media::stopPlayingAudio() - MEDIA_STATE -> MEDIA_STOPPED');
 
-      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
-      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
-      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
-      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
-      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
-      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
-      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
-
       Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
   },
   seekToAudio: function(successCallback, errorCallback, args) {
@@ -369,30 +420,35 @@ cordova.define(plugin_name, function(require, exports, module) {
   getCurrentPositionAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::getCurrentPositionAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       successCallback(audioObjects[id].currentTime);
   },
   startRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::startRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.rec();
   },
   stopRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::stopRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.stop();
   },
   release: function(successCallback, errorCallback, args) {
       exports.stopPlayingAudio(successCallback, errorCallback, args);
       var id = args[0];
+
+      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
+      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
+      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
+      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
+      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
+      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
+      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
+
       delete audioObjects[id];
       console.log('media::release()');
   },
old mode 100755 (executable)
new mode 100644 (file)
index 3378253..7e3199b
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.Media", function(require, exports, module)
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var argscheck = require('cordova/argscheck'),
old mode 100755 (executable)
new mode 100644 (file)
index 79b65f6..de998a5
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.MediaError", function(require, exports, mod
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index 1450e95..b8412e5
@@ -16,7 +16,7 @@ cordova.define("cordova-plugin-network-information.Connection", function(require
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index bfac2e3..206a8f7
@@ -16,6 +16,7 @@ cordova.define("cordova-plugin-network-information.network", function(require, e
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec'),
index 9b1143d530c8bbb356f963d0338ed77bc1845ab8..8e56f2d7034ec9d96974a0679eca37400c18ea3c 100755 (executable)
@@ -25,7 +25,7 @@ var _document = document || {};
 var playback = (function() {
   var soundElement;
   var counter = 1;
-  var soundPathArray = ['/usr/share/feedback/sound/operation/operation.wav', '/usr/share/feedback/sound/operation/home.wav'];
+  var soundPathArray = ['/usr/share/feedback/sound/operation/operation.wav', '/usr/share/feedback/sound/operation/home.wav', '/usr/share/feedback/sound/operation/back.wav'];
   var soundPathCount = 0;
 
   function win(v) {
old mode 100755 (executable)
new mode 100644 (file)
index 9331997..45b8e79
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-dialogs.notification", function(require, exports,
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec');
old mode 100755 (executable)
new mode 100644 (file)
index e592166..c344315
@@ -21,7 +21,13 @@ cordova.define('cordova-plugin-file.tizen.FileWriter', function(require, exports
 var convertTizenFileError = require('cordova-plugin-file.tizen.Errors');
 var rootUtils = require('cordova-plugin-file.tizen.rootUtils');
 
-// https://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
+//Code created with the help of Stack Overflow question
+//http://stackoverflow.com/a/18729931
+//Question by don kaka:
+//https://stackoverflow.com/users/2408835/don-kaka
+//Answer by Joni and Damian:
+//https://stackoverflow.com/users/318758/joni
+//https://stackoverflow.com/users/3390/damian
 function toUTF8Array(str) {
   var utf8 = [];
   for (var i = 0; i < str.length; ++i) {
old mode 100755 (executable)
new mode 100644 (file)
index 187d111..9dee943
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-file.fileSystems-roots", function(require, export
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 // Map of fsName -> FileSystem.
index 4c5131e287e8e2896fa7c20db0af7ac297cd7856..eb2388f310595477561e720b71c124834cdff197 100755 (executable)
@@ -59,28 +59,48 @@ function Globalization_dateToString(timestamp, successCb, errorCb, options) {
   var formatLength = (options && options.formatLength) || FORMAT_SHORT_STR;
   var selector = (options && options.selector) || SELECTOR_DATE_AND_TIME_STR;
 
-  tizen.cordova.globalization.dateToString(timestamp, formatLength, selector, successCb, errorCb);
+  try {
+    tizen.cordova.globalization.dateToString(timestamp, formatLength, selector, successCb, errorCb);
+  } catch (e) {
+    errorCb(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR,
+    'globalization not initialized'));
+  }
 }
 
 function Globalization_stringToDate(dateString, successCb, errorCb, options) {
   var formatLength = (options && options.formatLength) || FORMAT_SHORT_STR;
   var selector = (options && options.selector) || SELECTOR_DATE_AND_TIME_STR;
 
-  tizen.cordova.globalization.stringToDate(dateString, formatLength, selector, successCb, errorCb);
+  try {
+    tizen.cordova.globalization.stringToDate(dateString, formatLength, selector, successCb, errorCb);
+  } catch (e) {
+    errorCb(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR,
+    'globalization not initialized'));
+  }
 }
 
 function Globalization_getDatePattern(successCb, errorCb, options) {
   var formatLength = (options && options.formatLength) || FORMAT_SHORT_STR;
   var selector = (options && options.selector) || SELECTOR_DATE_AND_TIME_STR;
 
-  tizen.cordova.globalization.getDatePattern(formatLength, selector, successCb, errorCb);
+  try {
+    tizen.cordova.globalization.getDatePattern(formatLength, selector, successCb, errorCb);
+  } catch (e) {
+    errorCb(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR,
+    'globalization not initialized'));
+  }
 }
 
 function Globalization_getDateNames(successCb, errorCb, options) {
   var type = (options && options.type) || TYPE_WIDE;
   var item = (options && options.item) || ITEM_MONTHS;
 
-  tizen.cordova.globalization.getDateNames(type, item, successCb, errorCb);
+  try {
+    tizen.cordova.globalization.getDateNames(type, item, successCb, errorCb);
+  } catch (e) {
+    errorCb(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR,
+    'globalization not initialized'));
+  }
 }
 
 function Globalization_isDayLightSavingsTime(timestamp, successCb, errorCb) {
@@ -98,29 +118,54 @@ function Globalization_isDayLightSavingsTime(timestamp, successCb, errorCb) {
 }
 
 function Globalization_getFirstDayOfWeek(successCb, errorCb) {
-  tizen.cordova.globalization.getFirstDayOfWeek(successCb, errorCb);
+  try {
+    tizen.cordova.globalization.getFirstDayOfWeek(successCb, errorCb);
+  } catch (e) {
+    errorCb(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR,
+    'globalization not initialized'));
+  }
 }
 
 function Globalization_numberToString(number, successCb, errorCb, options) {
   var type = (options && options.type) || NUMBER_TYPE_DECIMAL;
 
-  tizen.cordova.globalization.numberToString(number, type, successCb, errorCb);
+  try {
+    tizen.cordova.globalization.numberToString(number, type, successCb, errorCb);
+  } catch (e) {
+    errorCb(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR,
+    'globalization not initialized'));
+  }
 }
 
 function Globalization_stringToNumber(numberStr, successCb, errorCb, options) {
   var type = (options && options.type) || NUMBER_TYPE_DECIMAL;
 
-  tizen.cordova.globalization.stringToNumber(numberStr, type, successCb, errorCb);
+  try {
+    tizen.cordova.globalization.stringToNumber(numberStr, type, successCb, errorCb);
+  } catch (e) {
+    errorCb(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR,
+    'globalization not initialized'));
+  }
 }
 
 function Globalization_getNumberPattern(successCb, errorCb, options) {
   var type = (options && options.type) || NUMBER_TYPE_DECIMAL;
 
-  tizen.cordova.globalization.getNumberPattern(type, successCb, errorCb);
+  try {
+    tizen.cordova.globalization.getNumberPattern(type, successCb, errorCb);
+  } catch (e) {
+    errorCb(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR,
+    'globalization not initialized'));
+  }
 }
 
 function Globalization_getCurrencyPattern(currencyCode, successCb, errorCb) {
-  tizen.cordova.globalization.getCurrencyPattern(currencyCode, successCb, errorCb);
+  try {
+    tizen.cordova.globalization.getCurrencyPattern(currencyCode, successCb, errorCb);
+  } catch (e) {
+    errorCb(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR,
+    'globalization not initialized'));
+  }
 }
 
 exports = {
index 0f29b19becb228858ffe8d337f31f0913a077eaf..9dff36b12dd596c92c80cd9fbc5c74830a068c1d 100755 (executable)
@@ -19,6 +19,19 @@ var plugin_name = 'cordova-plugin-media.tizen.Media';
 
 cordova.define(plugin_name, function(require, exports, module) {
 // TODO: remove -> end
+    function MediaError (code, msg) {
+        Object.defineProperties(this, {
+            code: {
+                value: code || null,
+                writable: false
+            },
+            message: {
+                value: msg || "",
+                writable: false
+            }
+        });
+    }
+    Object.assign(MediaError, window.MediaError);
 
     var audioObjects = {};
     var recorder = null;
@@ -27,7 +40,7 @@ cordova.define(plugin_name, function(require, exports, module) {
     var audioContext = window.AudioContext || window.webkitAudioContext;
     var context = new audioContext();
 
-    function Recorder(_filename) {
+    function Recorder(_filename, _errorCallback) {
         var recorder = null;
         var recording = false;
         var recordingLength = 0;
@@ -36,25 +49,38 @@ cordova.define(plugin_name, function(require, exports, module) {
         var sampleRate = null;
         var filename = _filename;
         var audioBlob = null;
+        var leftchannel;
+        var rightchannel;
+        var errorCallback = _errorCallback;
 
         this.rec = function(){
-
-            if (!navigator.getUserMedia)
+            if (navigator.mediaDevices.getUserMedia){
+                navigator.mediaDevices.getUserMedia({audio:true})
+                  .then(onGetUserMedia)
+                  .catch(function(e) {
+                       console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                   });
+            } else {
                 navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia ||
                     navigator.mozGetUserMedia || navigator.msGetUserMedia;
-
-            if (navigator.getUserMedia){
-                navigator.getUserMedia({audio:true}, onGetUserMedia, function(e) {
-                    console.log('Error capturing audio.');
-                });
-            } else {
-                console.log('getUserMedia not supported in this browser.');
+                if(navigator.getUserMedia) {
+                    navigator.getUserMedia({audio: true}, onGetUserMedia, function(e) {
+                        console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                    })
+                } else {
+                    console.log('getUserMedia not supported in this browser.');
+                }
             }
         }
 
         this.stop = function (){
             recording = false;
-            audioBlob.stop();
+            var tracks = audioBlob.getAudioTracks();
+
+            tracks.forEach(function(track) {
+                track.stop();
+            });
+
             recorder.disconnect();
 
             // flat the left and right channels down
@@ -100,8 +126,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
         function onGetUserMedia(stream){
             recording = true;
-            var leftchannel = [];
-            var rightchannel = [];
             recordingLength = 0;
 
             audioBlob = stream;
@@ -123,8 +147,10 @@ cordova.define(plugin_name, function(require, exports, module) {
              Lower values for buffer size will result in a lower (better) latency.
              Higher values will be necessary to avoid audio breakup and glitches */
             var bufferSize = 2048;
-            recorder = context.createJavaScriptNode(bufferSize, 2, 2);
+            recorder = context.createScriptProcessor(bufferSize, 2, 2);
 
+            rightchannel = [];
+            leftchannel = [];
             recorder.onaudioprocess = function(sample){
                 if (!recording) {
                     return;
@@ -150,26 +176,39 @@ cordova.define(plugin_name, function(require, exports, module) {
             }
 
             function onsuccess(dir) {
-                var recFile = dir.createFile(filename);
-                if (recFile != null) {
-                    recFile.openStream('w', function (fs) {
-                        fs.writeBytes(arr);
-                        fs.close();
-                    }, function (error) {
-                        console.log('Error ' + error.message);
-                    }, 'UTF-8');
+                var recFile
+                try {
+                    recFile = dir.createFile(filename);
+                    if (recFile != null) {
+                        recFile.openStream('w', function (fs) {
+                            try {
+                                fs.writeBytes(arr);
+                                fs.close();
+                            } catch (error) {
+                                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                            }
+                        }, function (error) {
+                            console.log('Failed to open stream error: ' + error.message);
+                            errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                        }, 'UTF-8');
+                    }
+                } catch (error) {
+                    console.log('Error during saving record to file');
+                    errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
                 }
             }
 
             function onerror(error) {
                 console.log('The error ' + error + ' occurred when resolving documents folder');
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
 
             try {
                 tizen.filesystem.resolve('documents', onsuccess, onerror, 'rw');
             }
             catch(error) {
-                console.log('Caught error ' + error);
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
         }
 
@@ -213,7 +252,10 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     console.log('media::create() - id =' + id + ', src =' + src);
 
-    recorder = new Recorder(src);
+    recorder = new Recorder(src, function(error) {
+        console.log('Recorder error callback');
+        Media.onStatus(id, Media.MEDIA_ERROR, error);
+    });
     audioObjects[id] = new Audio();
     audioObjects[id].isReady = false;
 
@@ -243,16 +285,12 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     audioObjects[id].onErrorCB = function (event) {
         var err = event.srcElement.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED ?
-            { code: MediaError.MEDIA_ERR_ABORTED } :
+            new MediaError(MediaError.MEDIA_ERR_ABORTED) :
             event.srcElement.error;
-        Object.freeze(err);
 
         console.log('media::onErrorCB() - MEDIA_ERROR -> ' + err);
 
         Media.onStatus(id, Media.MEDIA_ERROR, err);
-        if (errorCallback) {
-            errorCallback(err);
-        }
     };
 
     audioObjects[id].onPlayCB = function () {
@@ -313,14 +351,37 @@ cordova.define(plugin_name, function(require, exports, module) {
     audioObjects[id].isReady = true;
 
     if (!audioObjects[id].src) {
-      //assigning src sets playbackRate to default value equal to 1
-      //so if playbackRate was set before first run of play() function
-      //it should be saved and restored.
-      var rate = audioObjects[id].playbackRate;
+        var setSrc = function(id, src) {
+            //assigning src sets playbackRate to default value equal to 1
+            //so if playbackRate was set before first run of play() function
+            //it should be saved and restored.
+            var rate = audioObjects[id].playbackRate;
+
+            audioObjects[id].src = src;
+            audioObjects[id].playbackRate = rate;
+        };
+
+        if(RegExp('^((file\:\/\/)|(/)).*').test(src)) {
+            setSrc(id,src);
+            return;
+        }
 
-      audioObjects[id].src = src;
-      audioObjects[id].playbackRate = rate;
-      return;
+        if(!RegExp('.*!(\/\/).*').test(src)) {
+            try {
+                tizen.filesystem.resolve('documents', function(dir) {
+                    setSrc(id, dir.toURI() + '/' + src);
+                }, function(error) {
+                    console.log('Documents filesystem resolve failed');
+                    Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                }, 'r');
+            } catch (error) {
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+            }
+            return;
+        } else {
+            setSrc(id, src);
+        }
     }
 
     audioObjects[id].play();
@@ -338,16 +399,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
       console.log('media::stopPlayingAudio() - MEDIA_STATE -> MEDIA_STOPPED');
 
-      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
-      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
-      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
-      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
-      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
-      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
-      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
-
       Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
   },
   seekToAudio: function(successCallback, errorCallback, args) {
@@ -369,30 +420,35 @@ cordova.define(plugin_name, function(require, exports, module) {
   getCurrentPositionAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::getCurrentPositionAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       successCallback(audioObjects[id].currentTime);
   },
   startRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::startRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.rec();
   },
   stopRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::stopRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.stop();
   },
   release: function(successCallback, errorCallback, args) {
       exports.stopPlayingAudio(successCallback, errorCallback, args);
       var id = args[0];
+
+      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
+      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
+      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
+      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
+      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
+      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
+      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
+
       delete audioObjects[id];
       console.log('media::release()');
   },
old mode 100755 (executable)
new mode 100644 (file)
index 3378253..7e3199b
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.Media", function(require, exports, module)
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var argscheck = require('cordova/argscheck'),
old mode 100755 (executable)
new mode 100644 (file)
index 79b65f6..de998a5
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.MediaError", function(require, exports, mod
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index 1450e95..b8412e5
@@ -16,7 +16,7 @@ cordova.define("cordova-plugin-network-information.Connection", function(require
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index bfac2e3..206a8f7
@@ -16,6 +16,7 @@ cordova.define("cordova-plugin-network-information.network", function(require, e
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec'),
old mode 100755 (executable)
new mode 100644 (file)
index 9331997..45b8e79
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-dialogs.notification", function(require, exports,
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec');
old mode 100755 (executable)
new mode 100644 (file)
index e592166..c344315
@@ -21,7 +21,13 @@ cordova.define('cordova-plugin-file.tizen.FileWriter', function(require, exports
 var convertTizenFileError = require('cordova-plugin-file.tizen.Errors');
 var rootUtils = require('cordova-plugin-file.tizen.rootUtils');
 
-// https://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
+//Code created with the help of Stack Overflow question
+//http://stackoverflow.com/a/18729931
+//Question by don kaka:
+//https://stackoverflow.com/users/2408835/don-kaka
+//Answer by Joni and Damian:
+//https://stackoverflow.com/users/318758/joni
+//https://stackoverflow.com/users/3390/damian
 function toUTF8Array(str) {
   var utf8 = [];
   for (var i = 0; i < str.length; ++i) {
old mode 100755 (executable)
new mode 100644 (file)
index 187d111..9dee943
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-file.fileSystems-roots", function(require, export
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 // Map of fsName -> FileSystem.
index 0f29b19becb228858ffe8d337f31f0913a077eaf..9dff36b12dd596c92c80cd9fbc5c74830a068c1d 100755 (executable)
@@ -19,6 +19,19 @@ var plugin_name = 'cordova-plugin-media.tizen.Media';
 
 cordova.define(plugin_name, function(require, exports, module) {
 // TODO: remove -> end
+    function MediaError (code, msg) {
+        Object.defineProperties(this, {
+            code: {
+                value: code || null,
+                writable: false
+            },
+            message: {
+                value: msg || "",
+                writable: false
+            }
+        });
+    }
+    Object.assign(MediaError, window.MediaError);
 
     var audioObjects = {};
     var recorder = null;
@@ -27,7 +40,7 @@ cordova.define(plugin_name, function(require, exports, module) {
     var audioContext = window.AudioContext || window.webkitAudioContext;
     var context = new audioContext();
 
-    function Recorder(_filename) {
+    function Recorder(_filename, _errorCallback) {
         var recorder = null;
         var recording = false;
         var recordingLength = 0;
@@ -36,25 +49,38 @@ cordova.define(plugin_name, function(require, exports, module) {
         var sampleRate = null;
         var filename = _filename;
         var audioBlob = null;
+        var leftchannel;
+        var rightchannel;
+        var errorCallback = _errorCallback;
 
         this.rec = function(){
-
-            if (!navigator.getUserMedia)
+            if (navigator.mediaDevices.getUserMedia){
+                navigator.mediaDevices.getUserMedia({audio:true})
+                  .then(onGetUserMedia)
+                  .catch(function(e) {
+                       console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                   });
+            } else {
                 navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia ||
                     navigator.mozGetUserMedia || navigator.msGetUserMedia;
-
-            if (navigator.getUserMedia){
-                navigator.getUserMedia({audio:true}, onGetUserMedia, function(e) {
-                    console.log('Error capturing audio.');
-                });
-            } else {
-                console.log('getUserMedia not supported in this browser.');
+                if(navigator.getUserMedia) {
+                    navigator.getUserMedia({audio: true}, onGetUserMedia, function(e) {
+                        console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                    })
+                } else {
+                    console.log('getUserMedia not supported in this browser.');
+                }
             }
         }
 
         this.stop = function (){
             recording = false;
-            audioBlob.stop();
+            var tracks = audioBlob.getAudioTracks();
+
+            tracks.forEach(function(track) {
+                track.stop();
+            });
+
             recorder.disconnect();
 
             // flat the left and right channels down
@@ -100,8 +126,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
         function onGetUserMedia(stream){
             recording = true;
-            var leftchannel = [];
-            var rightchannel = [];
             recordingLength = 0;
 
             audioBlob = stream;
@@ -123,8 +147,10 @@ cordova.define(plugin_name, function(require, exports, module) {
              Lower values for buffer size will result in a lower (better) latency.
              Higher values will be necessary to avoid audio breakup and glitches */
             var bufferSize = 2048;
-            recorder = context.createJavaScriptNode(bufferSize, 2, 2);
+            recorder = context.createScriptProcessor(bufferSize, 2, 2);
 
+            rightchannel = [];
+            leftchannel = [];
             recorder.onaudioprocess = function(sample){
                 if (!recording) {
                     return;
@@ -150,26 +176,39 @@ cordova.define(plugin_name, function(require, exports, module) {
             }
 
             function onsuccess(dir) {
-                var recFile = dir.createFile(filename);
-                if (recFile != null) {
-                    recFile.openStream('w', function (fs) {
-                        fs.writeBytes(arr);
-                        fs.close();
-                    }, function (error) {
-                        console.log('Error ' + error.message);
-                    }, 'UTF-8');
+                var recFile
+                try {
+                    recFile = dir.createFile(filename);
+                    if (recFile != null) {
+                        recFile.openStream('w', function (fs) {
+                            try {
+                                fs.writeBytes(arr);
+                                fs.close();
+                            } catch (error) {
+                                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                            }
+                        }, function (error) {
+                            console.log('Failed to open stream error: ' + error.message);
+                            errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                        }, 'UTF-8');
+                    }
+                } catch (error) {
+                    console.log('Error during saving record to file');
+                    errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
                 }
             }
 
             function onerror(error) {
                 console.log('The error ' + error + ' occurred when resolving documents folder');
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
 
             try {
                 tizen.filesystem.resolve('documents', onsuccess, onerror, 'rw');
             }
             catch(error) {
-                console.log('Caught error ' + error);
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
         }
 
@@ -213,7 +252,10 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     console.log('media::create() - id =' + id + ', src =' + src);
 
-    recorder = new Recorder(src);
+    recorder = new Recorder(src, function(error) {
+        console.log('Recorder error callback');
+        Media.onStatus(id, Media.MEDIA_ERROR, error);
+    });
     audioObjects[id] = new Audio();
     audioObjects[id].isReady = false;
 
@@ -243,16 +285,12 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     audioObjects[id].onErrorCB = function (event) {
         var err = event.srcElement.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED ?
-            { code: MediaError.MEDIA_ERR_ABORTED } :
+            new MediaError(MediaError.MEDIA_ERR_ABORTED) :
             event.srcElement.error;
-        Object.freeze(err);
 
         console.log('media::onErrorCB() - MEDIA_ERROR -> ' + err);
 
         Media.onStatus(id, Media.MEDIA_ERROR, err);
-        if (errorCallback) {
-            errorCallback(err);
-        }
     };
 
     audioObjects[id].onPlayCB = function () {
@@ -313,14 +351,37 @@ cordova.define(plugin_name, function(require, exports, module) {
     audioObjects[id].isReady = true;
 
     if (!audioObjects[id].src) {
-      //assigning src sets playbackRate to default value equal to 1
-      //so if playbackRate was set before first run of play() function
-      //it should be saved and restored.
-      var rate = audioObjects[id].playbackRate;
+        var setSrc = function(id, src) {
+            //assigning src sets playbackRate to default value equal to 1
+            //so if playbackRate was set before first run of play() function
+            //it should be saved and restored.
+            var rate = audioObjects[id].playbackRate;
+
+            audioObjects[id].src = src;
+            audioObjects[id].playbackRate = rate;
+        };
+
+        if(RegExp('^((file\:\/\/)|(/)).*').test(src)) {
+            setSrc(id,src);
+            return;
+        }
 
-      audioObjects[id].src = src;
-      audioObjects[id].playbackRate = rate;
-      return;
+        if(!RegExp('.*!(\/\/).*').test(src)) {
+            try {
+                tizen.filesystem.resolve('documents', function(dir) {
+                    setSrc(id, dir.toURI() + '/' + src);
+                }, function(error) {
+                    console.log('Documents filesystem resolve failed');
+                    Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                }, 'r');
+            } catch (error) {
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+            }
+            return;
+        } else {
+            setSrc(id, src);
+        }
     }
 
     audioObjects[id].play();
@@ -338,16 +399,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
       console.log('media::stopPlayingAudio() - MEDIA_STATE -> MEDIA_STOPPED');
 
-      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
-      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
-      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
-      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
-      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
-      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
-      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
-
       Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
   },
   seekToAudio: function(successCallback, errorCallback, args) {
@@ -369,30 +420,35 @@ cordova.define(plugin_name, function(require, exports, module) {
   getCurrentPositionAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::getCurrentPositionAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       successCallback(audioObjects[id].currentTime);
   },
   startRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::startRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.rec();
   },
   stopRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::stopRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.stop();
   },
   release: function(successCallback, errorCallback, args) {
       exports.stopPlayingAudio(successCallback, errorCallback, args);
       var id = args[0];
+
+      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
+      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
+      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
+      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
+      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
+      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
+      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
+
       delete audioObjects[id];
       console.log('media::release()');
   },
old mode 100755 (executable)
new mode 100644 (file)
index 3378253..7e3199b
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.Media", function(require, exports, module)
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var argscheck = require('cordova/argscheck'),
old mode 100755 (executable)
new mode 100644 (file)
index 79b65f6..de998a5
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.MediaError", function(require, exports, mod
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index 1450e95..b8412e5
@@ -16,7 +16,7 @@ cordova.define("cordova-plugin-network-information.Connection", function(require
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index bfac2e3..206a8f7
@@ -16,6 +16,7 @@ cordova.define("cordova-plugin-network-information.network", function(require, e
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec'),
old mode 100755 (executable)
new mode 100644 (file)
index 9331997..45b8e79
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-dialogs.notification", function(require, exports,
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec');
old mode 100755 (executable)
new mode 100644 (file)
index e592166..c344315
@@ -21,7 +21,13 @@ cordova.define('cordova-plugin-file.tizen.FileWriter', function(require, exports
 var convertTizenFileError = require('cordova-plugin-file.tizen.Errors');
 var rootUtils = require('cordova-plugin-file.tizen.rootUtils');
 
-// https://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
+//Code created with the help of Stack Overflow question
+//http://stackoverflow.com/a/18729931
+//Question by don kaka:
+//https://stackoverflow.com/users/2408835/don-kaka
+//Answer by Joni and Damian:
+//https://stackoverflow.com/users/318758/joni
+//https://stackoverflow.com/users/3390/damian
 function toUTF8Array(str) {
   var utf8 = [];
   for (var i = 0; i < str.length; ++i) {
old mode 100755 (executable)
new mode 100644 (file)
index 187d111..9dee943
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-file.fileSystems-roots", function(require, export
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 // Map of fsName -> FileSystem.
index 0f29b19becb228858ffe8d337f31f0913a077eaf..9dff36b12dd596c92c80cd9fbc5c74830a068c1d 100755 (executable)
@@ -19,6 +19,19 @@ var plugin_name = 'cordova-plugin-media.tizen.Media';
 
 cordova.define(plugin_name, function(require, exports, module) {
 // TODO: remove -> end
+    function MediaError (code, msg) {
+        Object.defineProperties(this, {
+            code: {
+                value: code || null,
+                writable: false
+            },
+            message: {
+                value: msg || "",
+                writable: false
+            }
+        });
+    }
+    Object.assign(MediaError, window.MediaError);
 
     var audioObjects = {};
     var recorder = null;
@@ -27,7 +40,7 @@ cordova.define(plugin_name, function(require, exports, module) {
     var audioContext = window.AudioContext || window.webkitAudioContext;
     var context = new audioContext();
 
-    function Recorder(_filename) {
+    function Recorder(_filename, _errorCallback) {
         var recorder = null;
         var recording = false;
         var recordingLength = 0;
@@ -36,25 +49,38 @@ cordova.define(plugin_name, function(require, exports, module) {
         var sampleRate = null;
         var filename = _filename;
         var audioBlob = null;
+        var leftchannel;
+        var rightchannel;
+        var errorCallback = _errorCallback;
 
         this.rec = function(){
-
-            if (!navigator.getUserMedia)
+            if (navigator.mediaDevices.getUserMedia){
+                navigator.mediaDevices.getUserMedia({audio:true})
+                  .then(onGetUserMedia)
+                  .catch(function(e) {
+                       console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                   });
+            } else {
                 navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia ||
                     navigator.mozGetUserMedia || navigator.msGetUserMedia;
-
-            if (navigator.getUserMedia){
-                navigator.getUserMedia({audio:true}, onGetUserMedia, function(e) {
-                    console.log('Error capturing audio.');
-                });
-            } else {
-                console.log('getUserMedia not supported in this browser.');
+                if(navigator.getUserMedia) {
+                    navigator.getUserMedia({audio: true}, onGetUserMedia, function(e) {
+                        console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                    })
+                } else {
+                    console.log('getUserMedia not supported in this browser.');
+                }
             }
         }
 
         this.stop = function (){
             recording = false;
-            audioBlob.stop();
+            var tracks = audioBlob.getAudioTracks();
+
+            tracks.forEach(function(track) {
+                track.stop();
+            });
+
             recorder.disconnect();
 
             // flat the left and right channels down
@@ -100,8 +126,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
         function onGetUserMedia(stream){
             recording = true;
-            var leftchannel = [];
-            var rightchannel = [];
             recordingLength = 0;
 
             audioBlob = stream;
@@ -123,8 +147,10 @@ cordova.define(plugin_name, function(require, exports, module) {
              Lower values for buffer size will result in a lower (better) latency.
              Higher values will be necessary to avoid audio breakup and glitches */
             var bufferSize = 2048;
-            recorder = context.createJavaScriptNode(bufferSize, 2, 2);
+            recorder = context.createScriptProcessor(bufferSize, 2, 2);
 
+            rightchannel = [];
+            leftchannel = [];
             recorder.onaudioprocess = function(sample){
                 if (!recording) {
                     return;
@@ -150,26 +176,39 @@ cordova.define(plugin_name, function(require, exports, module) {
             }
 
             function onsuccess(dir) {
-                var recFile = dir.createFile(filename);
-                if (recFile != null) {
-                    recFile.openStream('w', function (fs) {
-                        fs.writeBytes(arr);
-                        fs.close();
-                    }, function (error) {
-                        console.log('Error ' + error.message);
-                    }, 'UTF-8');
+                var recFile
+                try {
+                    recFile = dir.createFile(filename);
+                    if (recFile != null) {
+                        recFile.openStream('w', function (fs) {
+                            try {
+                                fs.writeBytes(arr);
+                                fs.close();
+                            } catch (error) {
+                                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                            }
+                        }, function (error) {
+                            console.log('Failed to open stream error: ' + error.message);
+                            errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                        }, 'UTF-8');
+                    }
+                } catch (error) {
+                    console.log('Error during saving record to file');
+                    errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
                 }
             }
 
             function onerror(error) {
                 console.log('The error ' + error + ' occurred when resolving documents folder');
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
 
             try {
                 tizen.filesystem.resolve('documents', onsuccess, onerror, 'rw');
             }
             catch(error) {
-                console.log('Caught error ' + error);
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
         }
 
@@ -213,7 +252,10 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     console.log('media::create() - id =' + id + ', src =' + src);
 
-    recorder = new Recorder(src);
+    recorder = new Recorder(src, function(error) {
+        console.log('Recorder error callback');
+        Media.onStatus(id, Media.MEDIA_ERROR, error);
+    });
     audioObjects[id] = new Audio();
     audioObjects[id].isReady = false;
 
@@ -243,16 +285,12 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     audioObjects[id].onErrorCB = function (event) {
         var err = event.srcElement.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED ?
-            { code: MediaError.MEDIA_ERR_ABORTED } :
+            new MediaError(MediaError.MEDIA_ERR_ABORTED) :
             event.srcElement.error;
-        Object.freeze(err);
 
         console.log('media::onErrorCB() - MEDIA_ERROR -> ' + err);
 
         Media.onStatus(id, Media.MEDIA_ERROR, err);
-        if (errorCallback) {
-            errorCallback(err);
-        }
     };
 
     audioObjects[id].onPlayCB = function () {
@@ -313,14 +351,37 @@ cordova.define(plugin_name, function(require, exports, module) {
     audioObjects[id].isReady = true;
 
     if (!audioObjects[id].src) {
-      //assigning src sets playbackRate to default value equal to 1
-      //so if playbackRate was set before first run of play() function
-      //it should be saved and restored.
-      var rate = audioObjects[id].playbackRate;
+        var setSrc = function(id, src) {
+            //assigning src sets playbackRate to default value equal to 1
+            //so if playbackRate was set before first run of play() function
+            //it should be saved and restored.
+            var rate = audioObjects[id].playbackRate;
+
+            audioObjects[id].src = src;
+            audioObjects[id].playbackRate = rate;
+        };
+
+        if(RegExp('^((file\:\/\/)|(/)).*').test(src)) {
+            setSrc(id,src);
+            return;
+        }
 
-      audioObjects[id].src = src;
-      audioObjects[id].playbackRate = rate;
-      return;
+        if(!RegExp('.*!(\/\/).*').test(src)) {
+            try {
+                tizen.filesystem.resolve('documents', function(dir) {
+                    setSrc(id, dir.toURI() + '/' + src);
+                }, function(error) {
+                    console.log('Documents filesystem resolve failed');
+                    Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                }, 'r');
+            } catch (error) {
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+            }
+            return;
+        } else {
+            setSrc(id, src);
+        }
     }
 
     audioObjects[id].play();
@@ -338,16 +399,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
       console.log('media::stopPlayingAudio() - MEDIA_STATE -> MEDIA_STOPPED');
 
-      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
-      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
-      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
-      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
-      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
-      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
-      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
-
       Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
   },
   seekToAudio: function(successCallback, errorCallback, args) {
@@ -369,30 +420,35 @@ cordova.define(plugin_name, function(require, exports, module) {
   getCurrentPositionAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::getCurrentPositionAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       successCallback(audioObjects[id].currentTime);
   },
   startRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::startRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.rec();
   },
   stopRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::stopRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.stop();
   },
   release: function(successCallback, errorCallback, args) {
       exports.stopPlayingAudio(successCallback, errorCallback, args);
       var id = args[0];
+
+      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
+      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
+      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
+      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
+      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
+      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
+      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
+
       delete audioObjects[id];
       console.log('media::release()');
   },
old mode 100755 (executable)
new mode 100644 (file)
index 3378253..7e3199b
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.Media", function(require, exports, module)
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var argscheck = require('cordova/argscheck'),
old mode 100755 (executable)
new mode 100644 (file)
index 79b65f6..de998a5
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.MediaError", function(require, exports, mod
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index 1450e95..b8412e5
@@ -16,7 +16,7 @@ cordova.define("cordova-plugin-network-information.Connection", function(require
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index bfac2e3..206a8f7
@@ -16,6 +16,7 @@ cordova.define("cordova-plugin-network-information.network", function(require, e
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec'),
old mode 100755 (executable)
new mode 100644 (file)
index 9331997..45b8e79
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-dialogs.notification", function(require, exports,
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec');
old mode 100755 (executable)
new mode 100644 (file)
index e592166..c344315
@@ -21,7 +21,13 @@ cordova.define('cordova-plugin-file.tizen.FileWriter', function(require, exports
 var convertTizenFileError = require('cordova-plugin-file.tizen.Errors');
 var rootUtils = require('cordova-plugin-file.tizen.rootUtils');
 
-// https://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
+//Code created with the help of Stack Overflow question
+//http://stackoverflow.com/a/18729931
+//Question by don kaka:
+//https://stackoverflow.com/users/2408835/don-kaka
+//Answer by Joni and Damian:
+//https://stackoverflow.com/users/318758/joni
+//https://stackoverflow.com/users/3390/damian
 function toUTF8Array(str) {
   var utf8 = [];
   for (var i = 0; i < str.length; ++i) {
old mode 100755 (executable)
new mode 100644 (file)
index 187d111..9dee943
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-file.fileSystems-roots", function(require, export
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 // Map of fsName -> FileSystem.
index 0f29b19becb228858ffe8d337f31f0913a077eaf..9dff36b12dd596c92c80cd9fbc5c74830a068c1d 100755 (executable)
@@ -19,6 +19,19 @@ var plugin_name = 'cordova-plugin-media.tizen.Media';
 
 cordova.define(plugin_name, function(require, exports, module) {
 // TODO: remove -> end
+    function MediaError (code, msg) {
+        Object.defineProperties(this, {
+            code: {
+                value: code || null,
+                writable: false
+            },
+            message: {
+                value: msg || "",
+                writable: false
+            }
+        });
+    }
+    Object.assign(MediaError, window.MediaError);
 
     var audioObjects = {};
     var recorder = null;
@@ -27,7 +40,7 @@ cordova.define(plugin_name, function(require, exports, module) {
     var audioContext = window.AudioContext || window.webkitAudioContext;
     var context = new audioContext();
 
-    function Recorder(_filename) {
+    function Recorder(_filename, _errorCallback) {
         var recorder = null;
         var recording = false;
         var recordingLength = 0;
@@ -36,25 +49,38 @@ cordova.define(plugin_name, function(require, exports, module) {
         var sampleRate = null;
         var filename = _filename;
         var audioBlob = null;
+        var leftchannel;
+        var rightchannel;
+        var errorCallback = _errorCallback;
 
         this.rec = function(){
-
-            if (!navigator.getUserMedia)
+            if (navigator.mediaDevices.getUserMedia){
+                navigator.mediaDevices.getUserMedia({audio:true})
+                  .then(onGetUserMedia)
+                  .catch(function(e) {
+                       console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                   });
+            } else {
                 navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia ||
                     navigator.mozGetUserMedia || navigator.msGetUserMedia;
-
-            if (navigator.getUserMedia){
-                navigator.getUserMedia({audio:true}, onGetUserMedia, function(e) {
-                    console.log('Error capturing audio.');
-                });
-            } else {
-                console.log('getUserMedia not supported in this browser.');
+                if(navigator.getUserMedia) {
+                    navigator.getUserMedia({audio: true}, onGetUserMedia, function(e) {
+                        console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                    })
+                } else {
+                    console.log('getUserMedia not supported in this browser.');
+                }
             }
         }
 
         this.stop = function (){
             recording = false;
-            audioBlob.stop();
+            var tracks = audioBlob.getAudioTracks();
+
+            tracks.forEach(function(track) {
+                track.stop();
+            });
+
             recorder.disconnect();
 
             // flat the left and right channels down
@@ -100,8 +126,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
         function onGetUserMedia(stream){
             recording = true;
-            var leftchannel = [];
-            var rightchannel = [];
             recordingLength = 0;
 
             audioBlob = stream;
@@ -123,8 +147,10 @@ cordova.define(plugin_name, function(require, exports, module) {
              Lower values for buffer size will result in a lower (better) latency.
              Higher values will be necessary to avoid audio breakup and glitches */
             var bufferSize = 2048;
-            recorder = context.createJavaScriptNode(bufferSize, 2, 2);
+            recorder = context.createScriptProcessor(bufferSize, 2, 2);
 
+            rightchannel = [];
+            leftchannel = [];
             recorder.onaudioprocess = function(sample){
                 if (!recording) {
                     return;
@@ -150,26 +176,39 @@ cordova.define(plugin_name, function(require, exports, module) {
             }
 
             function onsuccess(dir) {
-                var recFile = dir.createFile(filename);
-                if (recFile != null) {
-                    recFile.openStream('w', function (fs) {
-                        fs.writeBytes(arr);
-                        fs.close();
-                    }, function (error) {
-                        console.log('Error ' + error.message);
-                    }, 'UTF-8');
+                var recFile
+                try {
+                    recFile = dir.createFile(filename);
+                    if (recFile != null) {
+                        recFile.openStream('w', function (fs) {
+                            try {
+                                fs.writeBytes(arr);
+                                fs.close();
+                            } catch (error) {
+                                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                            }
+                        }, function (error) {
+                            console.log('Failed to open stream error: ' + error.message);
+                            errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                        }, 'UTF-8');
+                    }
+                } catch (error) {
+                    console.log('Error during saving record to file');
+                    errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
                 }
             }
 
             function onerror(error) {
                 console.log('The error ' + error + ' occurred when resolving documents folder');
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
 
             try {
                 tizen.filesystem.resolve('documents', onsuccess, onerror, 'rw');
             }
             catch(error) {
-                console.log('Caught error ' + error);
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
         }
 
@@ -213,7 +252,10 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     console.log('media::create() - id =' + id + ', src =' + src);
 
-    recorder = new Recorder(src);
+    recorder = new Recorder(src, function(error) {
+        console.log('Recorder error callback');
+        Media.onStatus(id, Media.MEDIA_ERROR, error);
+    });
     audioObjects[id] = new Audio();
     audioObjects[id].isReady = false;
 
@@ -243,16 +285,12 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     audioObjects[id].onErrorCB = function (event) {
         var err = event.srcElement.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED ?
-            { code: MediaError.MEDIA_ERR_ABORTED } :
+            new MediaError(MediaError.MEDIA_ERR_ABORTED) :
             event.srcElement.error;
-        Object.freeze(err);
 
         console.log('media::onErrorCB() - MEDIA_ERROR -> ' + err);
 
         Media.onStatus(id, Media.MEDIA_ERROR, err);
-        if (errorCallback) {
-            errorCallback(err);
-        }
     };
 
     audioObjects[id].onPlayCB = function () {
@@ -313,14 +351,37 @@ cordova.define(plugin_name, function(require, exports, module) {
     audioObjects[id].isReady = true;
 
     if (!audioObjects[id].src) {
-      //assigning src sets playbackRate to default value equal to 1
-      //so if playbackRate was set before first run of play() function
-      //it should be saved and restored.
-      var rate = audioObjects[id].playbackRate;
+        var setSrc = function(id, src) {
+            //assigning src sets playbackRate to default value equal to 1
+            //so if playbackRate was set before first run of play() function
+            //it should be saved and restored.
+            var rate = audioObjects[id].playbackRate;
+
+            audioObjects[id].src = src;
+            audioObjects[id].playbackRate = rate;
+        };
+
+        if(RegExp('^((file\:\/\/)|(/)).*').test(src)) {
+            setSrc(id,src);
+            return;
+        }
 
-      audioObjects[id].src = src;
-      audioObjects[id].playbackRate = rate;
-      return;
+        if(!RegExp('.*!(\/\/).*').test(src)) {
+            try {
+                tizen.filesystem.resolve('documents', function(dir) {
+                    setSrc(id, dir.toURI() + '/' + src);
+                }, function(error) {
+                    console.log('Documents filesystem resolve failed');
+                    Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                }, 'r');
+            } catch (error) {
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+            }
+            return;
+        } else {
+            setSrc(id, src);
+        }
     }
 
     audioObjects[id].play();
@@ -338,16 +399,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
       console.log('media::stopPlayingAudio() - MEDIA_STATE -> MEDIA_STOPPED');
 
-      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
-      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
-      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
-      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
-      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
-      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
-      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
-
       Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
   },
   seekToAudio: function(successCallback, errorCallback, args) {
@@ -369,30 +420,35 @@ cordova.define(plugin_name, function(require, exports, module) {
   getCurrentPositionAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::getCurrentPositionAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       successCallback(audioObjects[id].currentTime);
   },
   startRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::startRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.rec();
   },
   stopRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::stopRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.stop();
   },
   release: function(successCallback, errorCallback, args) {
       exports.stopPlayingAudio(successCallback, errorCallback, args);
       var id = args[0];
+
+      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
+      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
+      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
+      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
+      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
+      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
+      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
+
       delete audioObjects[id];
       console.log('media::release()');
   },
old mode 100755 (executable)
new mode 100644 (file)
index 3378253..7e3199b
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.Media", function(require, exports, module)
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var argscheck = require('cordova/argscheck'),
old mode 100755 (executable)
new mode 100644 (file)
index 79b65f6..de998a5
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.MediaError", function(require, exports, mod
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index 1450e95..b8412e5
@@ -16,7 +16,7 @@ cordova.define("cordova-plugin-network-information.Connection", function(require
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index bfac2e3..206a8f7
@@ -16,6 +16,7 @@ cordova.define("cordova-plugin-network-information.network", function(require, e
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec'),
old mode 100755 (executable)
new mode 100644 (file)
index 9331997..45b8e79
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-dialogs.notification", function(require, exports,
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec');
old mode 100755 (executable)
new mode 100644 (file)
index e592166..c344315
@@ -21,7 +21,13 @@ cordova.define('cordova-plugin-file.tizen.FileWriter', function(require, exports
 var convertTizenFileError = require('cordova-plugin-file.tizen.Errors');
 var rootUtils = require('cordova-plugin-file.tizen.rootUtils');
 
-// https://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
+//Code created with the help of Stack Overflow question
+//http://stackoverflow.com/a/18729931
+//Question by don kaka:
+//https://stackoverflow.com/users/2408835/don-kaka
+//Answer by Joni and Damian:
+//https://stackoverflow.com/users/318758/joni
+//https://stackoverflow.com/users/3390/damian
 function toUTF8Array(str) {
   var utf8 = [];
   for (var i = 0; i < str.length; ++i) {
old mode 100755 (executable)
new mode 100644 (file)
index 187d111..9dee943
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-file.fileSystems-roots", function(require, export
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 // Map of fsName -> FileSystem.
index 0f29b19becb228858ffe8d337f31f0913a077eaf..9dff36b12dd596c92c80cd9fbc5c74830a068c1d 100755 (executable)
@@ -19,6 +19,19 @@ var plugin_name = 'cordova-plugin-media.tizen.Media';
 
 cordova.define(plugin_name, function(require, exports, module) {
 // TODO: remove -> end
+    function MediaError (code, msg) {
+        Object.defineProperties(this, {
+            code: {
+                value: code || null,
+                writable: false
+            },
+            message: {
+                value: msg || "",
+                writable: false
+            }
+        });
+    }
+    Object.assign(MediaError, window.MediaError);
 
     var audioObjects = {};
     var recorder = null;
@@ -27,7 +40,7 @@ cordova.define(plugin_name, function(require, exports, module) {
     var audioContext = window.AudioContext || window.webkitAudioContext;
     var context = new audioContext();
 
-    function Recorder(_filename) {
+    function Recorder(_filename, _errorCallback) {
         var recorder = null;
         var recording = false;
         var recordingLength = 0;
@@ -36,25 +49,38 @@ cordova.define(plugin_name, function(require, exports, module) {
         var sampleRate = null;
         var filename = _filename;
         var audioBlob = null;
+        var leftchannel;
+        var rightchannel;
+        var errorCallback = _errorCallback;
 
         this.rec = function(){
-
-            if (!navigator.getUserMedia)
+            if (navigator.mediaDevices.getUserMedia){
+                navigator.mediaDevices.getUserMedia({audio:true})
+                  .then(onGetUserMedia)
+                  .catch(function(e) {
+                       console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                   });
+            } else {
                 navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia ||
                     navigator.mozGetUserMedia || navigator.msGetUserMedia;
-
-            if (navigator.getUserMedia){
-                navigator.getUserMedia({audio:true}, onGetUserMedia, function(e) {
-                    console.log('Error capturing audio.');
-                });
-            } else {
-                console.log('getUserMedia not supported in this browser.');
+                if(navigator.getUserMedia) {
+                    navigator.getUserMedia({audio: true}, onGetUserMedia, function(e) {
+                        console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                    })
+                } else {
+                    console.log('getUserMedia not supported in this browser.');
+                }
             }
         }
 
         this.stop = function (){
             recording = false;
-            audioBlob.stop();
+            var tracks = audioBlob.getAudioTracks();
+
+            tracks.forEach(function(track) {
+                track.stop();
+            });
+
             recorder.disconnect();
 
             // flat the left and right channels down
@@ -100,8 +126,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
         function onGetUserMedia(stream){
             recording = true;
-            var leftchannel = [];
-            var rightchannel = [];
             recordingLength = 0;
 
             audioBlob = stream;
@@ -123,8 +147,10 @@ cordova.define(plugin_name, function(require, exports, module) {
              Lower values for buffer size will result in a lower (better) latency.
              Higher values will be necessary to avoid audio breakup and glitches */
             var bufferSize = 2048;
-            recorder = context.createJavaScriptNode(bufferSize, 2, 2);
+            recorder = context.createScriptProcessor(bufferSize, 2, 2);
 
+            rightchannel = [];
+            leftchannel = [];
             recorder.onaudioprocess = function(sample){
                 if (!recording) {
                     return;
@@ -150,26 +176,39 @@ cordova.define(plugin_name, function(require, exports, module) {
             }
 
             function onsuccess(dir) {
-                var recFile = dir.createFile(filename);
-                if (recFile != null) {
-                    recFile.openStream('w', function (fs) {
-                        fs.writeBytes(arr);
-                        fs.close();
-                    }, function (error) {
-                        console.log('Error ' + error.message);
-                    }, 'UTF-8');
+                var recFile
+                try {
+                    recFile = dir.createFile(filename);
+                    if (recFile != null) {
+                        recFile.openStream('w', function (fs) {
+                            try {
+                                fs.writeBytes(arr);
+                                fs.close();
+                            } catch (error) {
+                                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                            }
+                        }, function (error) {
+                            console.log('Failed to open stream error: ' + error.message);
+                            errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                        }, 'UTF-8');
+                    }
+                } catch (error) {
+                    console.log('Error during saving record to file');
+                    errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
                 }
             }
 
             function onerror(error) {
                 console.log('The error ' + error + ' occurred when resolving documents folder');
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
 
             try {
                 tizen.filesystem.resolve('documents', onsuccess, onerror, 'rw');
             }
             catch(error) {
-                console.log('Caught error ' + error);
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
         }
 
@@ -213,7 +252,10 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     console.log('media::create() - id =' + id + ', src =' + src);
 
-    recorder = new Recorder(src);
+    recorder = new Recorder(src, function(error) {
+        console.log('Recorder error callback');
+        Media.onStatus(id, Media.MEDIA_ERROR, error);
+    });
     audioObjects[id] = new Audio();
     audioObjects[id].isReady = false;
 
@@ -243,16 +285,12 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     audioObjects[id].onErrorCB = function (event) {
         var err = event.srcElement.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED ?
-            { code: MediaError.MEDIA_ERR_ABORTED } :
+            new MediaError(MediaError.MEDIA_ERR_ABORTED) :
             event.srcElement.error;
-        Object.freeze(err);
 
         console.log('media::onErrorCB() - MEDIA_ERROR -> ' + err);
 
         Media.onStatus(id, Media.MEDIA_ERROR, err);
-        if (errorCallback) {
-            errorCallback(err);
-        }
     };
 
     audioObjects[id].onPlayCB = function () {
@@ -313,14 +351,37 @@ cordova.define(plugin_name, function(require, exports, module) {
     audioObjects[id].isReady = true;
 
     if (!audioObjects[id].src) {
-      //assigning src sets playbackRate to default value equal to 1
-      //so if playbackRate was set before first run of play() function
-      //it should be saved and restored.
-      var rate = audioObjects[id].playbackRate;
+        var setSrc = function(id, src) {
+            //assigning src sets playbackRate to default value equal to 1
+            //so if playbackRate was set before first run of play() function
+            //it should be saved and restored.
+            var rate = audioObjects[id].playbackRate;
+
+            audioObjects[id].src = src;
+            audioObjects[id].playbackRate = rate;
+        };
+
+        if(RegExp('^((file\:\/\/)|(/)).*').test(src)) {
+            setSrc(id,src);
+            return;
+        }
 
-      audioObjects[id].src = src;
-      audioObjects[id].playbackRate = rate;
-      return;
+        if(!RegExp('.*!(\/\/).*').test(src)) {
+            try {
+                tizen.filesystem.resolve('documents', function(dir) {
+                    setSrc(id, dir.toURI() + '/' + src);
+                }, function(error) {
+                    console.log('Documents filesystem resolve failed');
+                    Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                }, 'r');
+            } catch (error) {
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+            }
+            return;
+        } else {
+            setSrc(id, src);
+        }
     }
 
     audioObjects[id].play();
@@ -338,16 +399,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
       console.log('media::stopPlayingAudio() - MEDIA_STATE -> MEDIA_STOPPED');
 
-      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
-      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
-      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
-      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
-      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
-      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
-      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
-
       Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
   },
   seekToAudio: function(successCallback, errorCallback, args) {
@@ -369,30 +420,35 @@ cordova.define(plugin_name, function(require, exports, module) {
   getCurrentPositionAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::getCurrentPositionAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       successCallback(audioObjects[id].currentTime);
   },
   startRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::startRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.rec();
   },
   stopRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::stopRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.stop();
   },
   release: function(successCallback, errorCallback, args) {
       exports.stopPlayingAudio(successCallback, errorCallback, args);
       var id = args[0];
+
+      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
+      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
+      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
+      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
+      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
+      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
+      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
+
       delete audioObjects[id];
       console.log('media::release()');
   },
old mode 100755 (executable)
new mode 100644 (file)
index 3378253..7e3199b
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.Media", function(require, exports, module)
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var argscheck = require('cordova/argscheck'),
old mode 100755 (executable)
new mode 100644 (file)
index 79b65f6..de998a5
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.MediaError", function(require, exports, mod
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index 1450e95..b8412e5
@@ -16,7 +16,7 @@ cordova.define("cordova-plugin-network-information.Connection", function(require
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index bfac2e3..206a8f7
@@ -16,6 +16,7 @@ cordova.define("cordova-plugin-network-information.network", function(require, e
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec'),
old mode 100755 (executable)
new mode 100644 (file)
index 9331997..45b8e79
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-dialogs.notification", function(require, exports,
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec');
old mode 100755 (executable)
new mode 100644 (file)
index e592166..c344315
@@ -21,7 +21,13 @@ cordova.define('cordova-plugin-file.tizen.FileWriter', function(require, exports
 var convertTizenFileError = require('cordova-plugin-file.tizen.Errors');
 var rootUtils = require('cordova-plugin-file.tizen.rootUtils');
 
-// https://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
+//Code created with the help of Stack Overflow question
+//http://stackoverflow.com/a/18729931
+//Question by don kaka:
+//https://stackoverflow.com/users/2408835/don-kaka
+//Answer by Joni and Damian:
+//https://stackoverflow.com/users/318758/joni
+//https://stackoverflow.com/users/3390/damian
 function toUTF8Array(str) {
   var utf8 = [];
   for (var i = 0; i < str.length; ++i) {
old mode 100755 (executable)
new mode 100644 (file)
index 187d111..9dee943
@@ -17,6 +17,7 @@ cordova.define("cordova-plugin-file.fileSystems-roots", function(require, export
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 // Map of fsName -> FileSystem.
index 0f29b19becb228858ffe8d337f31f0913a077eaf..9dff36b12dd596c92c80cd9fbc5c74830a068c1d 100755 (executable)
@@ -19,6 +19,19 @@ var plugin_name = 'cordova-plugin-media.tizen.Media';
 
 cordova.define(plugin_name, function(require, exports, module) {
 // TODO: remove -> end
+    function MediaError (code, msg) {
+        Object.defineProperties(this, {
+            code: {
+                value: code || null,
+                writable: false
+            },
+            message: {
+                value: msg || "",
+                writable: false
+            }
+        });
+    }
+    Object.assign(MediaError, window.MediaError);
 
     var audioObjects = {};
     var recorder = null;
@@ -27,7 +40,7 @@ cordova.define(plugin_name, function(require, exports, module) {
     var audioContext = window.AudioContext || window.webkitAudioContext;
     var context = new audioContext();
 
-    function Recorder(_filename) {
+    function Recorder(_filename, _errorCallback) {
         var recorder = null;
         var recording = false;
         var recordingLength = 0;
@@ -36,25 +49,38 @@ cordova.define(plugin_name, function(require, exports, module) {
         var sampleRate = null;
         var filename = _filename;
         var audioBlob = null;
+        var leftchannel;
+        var rightchannel;
+        var errorCallback = _errorCallback;
 
         this.rec = function(){
-
-            if (!navigator.getUserMedia)
+            if (navigator.mediaDevices.getUserMedia){
+                navigator.mediaDevices.getUserMedia({audio:true})
+                  .then(onGetUserMedia)
+                  .catch(function(e) {
+                       console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                   });
+            } else {
                 navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia ||
                     navigator.mozGetUserMedia || navigator.msGetUserMedia;
-
-            if (navigator.getUserMedia){
-                navigator.getUserMedia({audio:true}, onGetUserMedia, function(e) {
-                    console.log('Error capturing audio.');
-                });
-            } else {
-                console.log('getUserMedia not supported in this browser.');
+                if(navigator.getUserMedia) {
+                    navigator.getUserMedia({audio: true}, onGetUserMedia, function(e) {
+                        console.log('Error capturing audio: ' + e.name + ': ' + e.message);
+                    })
+                } else {
+                    console.log('getUserMedia not supported in this browser.');
+                }
             }
         }
 
         this.stop = function (){
             recording = false;
-            audioBlob.stop();
+            var tracks = audioBlob.getAudioTracks();
+
+            tracks.forEach(function(track) {
+                track.stop();
+            });
+
             recorder.disconnect();
 
             // flat the left and right channels down
@@ -100,8 +126,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
         function onGetUserMedia(stream){
             recording = true;
-            var leftchannel = [];
-            var rightchannel = [];
             recordingLength = 0;
 
             audioBlob = stream;
@@ -123,8 +147,10 @@ cordova.define(plugin_name, function(require, exports, module) {
              Lower values for buffer size will result in a lower (better) latency.
              Higher values will be necessary to avoid audio breakup and glitches */
             var bufferSize = 2048;
-            recorder = context.createJavaScriptNode(bufferSize, 2, 2);
+            recorder = context.createScriptProcessor(bufferSize, 2, 2);
 
+            rightchannel = [];
+            leftchannel = [];
             recorder.onaudioprocess = function(sample){
                 if (!recording) {
                     return;
@@ -150,26 +176,39 @@ cordova.define(plugin_name, function(require, exports, module) {
             }
 
             function onsuccess(dir) {
-                var recFile = dir.createFile(filename);
-                if (recFile != null) {
-                    recFile.openStream('w', function (fs) {
-                        fs.writeBytes(arr);
-                        fs.close();
-                    }, function (error) {
-                        console.log('Error ' + error.message);
-                    }, 'UTF-8');
+                var recFile
+                try {
+                    recFile = dir.createFile(filename);
+                    if (recFile != null) {
+                        recFile.openStream('w', function (fs) {
+                            try {
+                                fs.writeBytes(arr);
+                                fs.close();
+                            } catch (error) {
+                                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                            }
+                        }, function (error) {
+                            console.log('Failed to open stream error: ' + error.message);
+                            errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                        }, 'UTF-8');
+                    }
+                } catch (error) {
+                    console.log('Error during saving record to file');
+                    errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
                 }
             }
 
             function onerror(error) {
                 console.log('The error ' + error + ' occurred when resolving documents folder');
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
 
             try {
                 tizen.filesystem.resolve('documents', onsuccess, onerror, 'rw');
             }
             catch(error) {
-                console.log('Caught error ' + error);
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                errorCallback(new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
             }
         }
 
@@ -213,7 +252,10 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     console.log('media::create() - id =' + id + ', src =' + src);
 
-    recorder = new Recorder(src);
+    recorder = new Recorder(src, function(error) {
+        console.log('Recorder error callback');
+        Media.onStatus(id, Media.MEDIA_ERROR, error);
+    });
     audioObjects[id] = new Audio();
     audioObjects[id].isReady = false;
 
@@ -243,16 +285,12 @@ cordova.define(plugin_name, function(require, exports, module) {
 
     audioObjects[id].onErrorCB = function (event) {
         var err = event.srcElement.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED ?
-            { code: MediaError.MEDIA_ERR_ABORTED } :
+            new MediaError(MediaError.MEDIA_ERR_ABORTED) :
             event.srcElement.error;
-        Object.freeze(err);
 
         console.log('media::onErrorCB() - MEDIA_ERROR -> ' + err);
 
         Media.onStatus(id, Media.MEDIA_ERROR, err);
-        if (errorCallback) {
-            errorCallback(err);
-        }
     };
 
     audioObjects[id].onPlayCB = function () {
@@ -313,14 +351,37 @@ cordova.define(plugin_name, function(require, exports, module) {
     audioObjects[id].isReady = true;
 
     if (!audioObjects[id].src) {
-      //assigning src sets playbackRate to default value equal to 1
-      //so if playbackRate was set before first run of play() function
-      //it should be saved and restored.
-      var rate = audioObjects[id].playbackRate;
+        var setSrc = function(id, src) {
+            //assigning src sets playbackRate to default value equal to 1
+            //so if playbackRate was set before first run of play() function
+            //it should be saved and restored.
+            var rate = audioObjects[id].playbackRate;
+
+            audioObjects[id].src = src;
+            audioObjects[id].playbackRate = rate;
+        };
+
+        if(RegExp('^((file\:\/\/)|(/)).*').test(src)) {
+            setSrc(id,src);
+            return;
+        }
 
-      audioObjects[id].src = src;
-      audioObjects[id].playbackRate = rate;
-      return;
+        if(!RegExp('.*!(\/\/).*').test(src)) {
+            try {
+                tizen.filesystem.resolve('documents', function(dir) {
+                    setSrc(id, dir.toURI() + '/' + src);
+                }, function(error) {
+                    console.log('Documents filesystem resolve failed');
+                    Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+                }, 'r');
+            } catch (error) {
+                console.log('Caught error during documents folder resolve: ' + error.message);
+                Media.onStatus(id, Media.MEDIA_ERROR, new MediaError(MediaError.MEDIA_ERR_ABORTED, error.message));
+            }
+            return;
+        } else {
+            setSrc(id, src);
+        }
     }
 
     audioObjects[id].play();
@@ -338,16 +399,6 @@ cordova.define(plugin_name, function(require, exports, module) {
 
       console.log('media::stopPlayingAudio() - MEDIA_STATE -> MEDIA_STOPPED');
 
-      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
-      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
-      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
-      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
-      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
-      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
-      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
-      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
-
       Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
   },
   seekToAudio: function(successCallback, errorCallback, args) {
@@ -369,30 +420,35 @@ cordova.define(plugin_name, function(require, exports, module) {
   getCurrentPositionAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::getCurrentPositionAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       successCallback(audioObjects[id].currentTime);
   },
   startRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::startRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.rec();
   },
   stopRecordingAudio: function(successCallback, errorCallback, args) {
       var id = args[0];
       console.log('media::stopRecordingAudio()');
-      if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = args[1];
-      }
+
       recorder.stop();
   },
   release: function(successCallback, errorCallback, args) {
       exports.stopPlayingAudio(successCallback, errorCallback, args);
       var id = args[0];
+
+      audioObjects[id].removeEventListener('canplay', audioObjects[id].onCanPlayCB);
+      audioObjects[id].removeEventListener('ended', audioObjects[id].onEndedCB);
+      audioObjects[id].removeEventListener('timeupdate', audioObjects[id].onTimeUpdateCB);
+      audioObjects[id].removeEventListener('durationchange', audioObjects[id].onDurationChangeCB);
+      audioObjects[id].removeEventListener('playing', audioObjects[id].onPlayingCB);
+      audioObjects[id].removeEventListener('play', audioObjects[id].onPlayCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onErrorCB);
+      audioObjects[id].removeEventListener('error', audioObjects[id].onStalledCB);
+      audioObjects[id].removeEventListener('seeked', audioObjects[id].onSeekedCB);
+
       delete audioObjects[id];
       console.log('media::release()');
   },
old mode 100755 (executable)
new mode 100644 (file)
index 3378253..7e3199b
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.Media", function(require, exports, module)
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var argscheck = require('cordova/argscheck'),
old mode 100755 (executable)
new mode 100644 (file)
index 79b65f6..de998a5
@@ -18,6 +18,7 @@ cordova.define("cordova-plugin-media.MediaError", function(require, exports, mod
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index 1450e95..b8412e5
@@ -16,7 +16,7 @@ cordova.define("cordova-plugin-network-information.Connection", function(require
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 /**
old mode 100755 (executable)
new mode 100644 (file)
index bfac2e3..206a8f7
@@ -16,6 +16,7 @@ cordova.define("cordova-plugin-network-information.network", function(require, e
  * specific language governing permissions and limitations
  * under the License.
  *
+ * Modifications copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 */
 
 var exec = require('cordova/exec'),