diff --git a/dConnectDevicePlugin/dConnectDeviceHost/dConnectDeviceHost/Classes/profile/DPHostMediaStreamRecording/Recorders/Photo/DPHostCameraRecorder.m b/dConnectDevicePlugin/dConnectDeviceHost/dConnectDeviceHost/Classes/profile/DPHostMediaStreamRecording/Recorders/Photo/DPHostCameraRecorder.m index ef7c4104..ab436a97 100644 --- a/dConnectDevicePlugin/dConnectDeviceHost/dConnectDeviceHost/Classes/profile/DPHostMediaStreamRecording/Recorders/Photo/DPHostCameraRecorder.m +++ b/dConnectDevicePlugin/dConnectDeviceHost/dConnectDeviceHost/Classes/profile/DPHostMediaStreamRecording/Recorders/Photo/DPHostCameraRecorder.m @@ -6,14 +6,16 @@ // Released under the MIT license // http://opensource.org/licenses/mit-license.php // - +#import #import #import #import "DPHostCameraRecorder.h" #import "DPHostRecorder.h" #import "DPHostUtils.h" #import "DPHostRecorderUtils.h" -@interface DPHostCameraRecorder() + +static NSString *const kDPHostStartPreviewNotificationId = @"kDPHostStartPreviewNotificationId"; +@interface DPHostCameraRecorder() @property (nonatomic) DPHostSimpleHttpServer *httpServer; /// Preview APIでプレビュー画像URIの配送を行うかどうか。 @property (nonatomic) BOOL sendPreview; @@ -117,7 +119,7 @@ - (void)takePhotoWithSuccessCompletion:(void (^)(NSURL *assetURL))successComplet } [weakSelf saveFileWithCompletionHandler:^(NSURL *assetURL, NSError *error) { - if ([weakSelf.session isRunning]) { + if ([weakSelf.session isRunning] && !weakSelf.sendPreview) { [weakSelf.session stopRunning]; } if (error) { @@ -125,6 +127,7 @@ - (void)takePhotoWithSuccessCompletion:(void (^)(NSURL *assetURL))successComplet } else { successCompletion(assetURL); } + }]; }]; } @@ -179,6 +182,7 @@ - (void)startWebServerWithSuccessCompletion:(void (^)(NSString *uri))successComp failCompletion(@"MJPEG Server cannot running."); return; } + [self showPreviewNotification]; successCompletion(url); } @@ -193,7 +197,7 @@ - (void)stopWebServer self.sendPreview = NO; // 次回プレビュー開始時に影響を与えない為に、初期値(無効値)を設定する。 self.lastPreviewTimestamp = kCMTimeInvalid; - + [self hidePreviewNotification]; } #pragma mark - Private Method @@ -420,4 +424,60 @@ - (void) sendPreviewDataWithSampleBuffer:(CMSampleBufferRef)sampleBuffer } } + +#pragma mark - Notification Control +- (void)showPreviewNotification +{ + UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init]; + content.title = @"カメラ撮影中(iOS Host Camera Preview)"; + content.body = @"タップして撮影を停止します。"; + // Deliver the notification in five seconds. + UNTimeIntervalNotificationTrigger* trigger = [UNTimeIntervalNotificationTrigger + triggerWithTimeInterval:1 + repeats:NO]; + UNNotificationRequest* nRequest = [UNNotificationRequest + requestWithIdentifier:kDPHostStartPreviewNotificationId + content:content + trigger:trigger]; + + // Schedule the notification. + dispatch_async(dispatch_get_main_queue(), ^{ + UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter]; + center.delegate = self; + [center addNotificationRequest:nRequest + withCompletionHandler:^(NSError * _Nullable error) { + }]; + + }); +} + +- (void)hidePreviewNotification +{ + UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter]; + [center getDeliveredNotificationsWithCompletionHandler:^(NSArray * _Nonnull notifications) { + for (UNNotification *notification in notifications) { + NSString *currentId = notification.request.identifier; + if ([currentId isEqualToString:kDPHostStartPreviewNotificationId]) { + [center removeDeliveredNotificationsWithIdentifiers:@[kDPHostStartPreviewNotificationId]]; + return; + } + } + }]; + +} +#pragma mark - Notification Delegate +- (void)userNotificationCenter:(UNUserNotificationCenter *)center +didReceiveNotificationResponse:(UNNotificationResponse *)response + withCompletionHandler:(void (^)(void))completionHandler { + completionHandler(); + [self stopWebServer]; +} + +- (void)userNotificationCenter:(UNUserNotificationCenter *)center + willPresentNotification:(UNNotification *)notification + withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler { + completionHandler(UNNotificationPresentationOptionBadge | + UNNotificationPresentationOptionSound | + UNNotificationPresentationOptionAlert); +}; @end diff --git a/dConnectDevicePlugin/dConnectDeviceHost/dConnectDeviceHost/Classes/profile/DPHostNotificationProfile.m b/dConnectDevicePlugin/dConnectDeviceHost/dConnectDeviceHost/Classes/profile/DPHostNotificationProfile.m index c702e1b9..dd29b139 100755 --- a/dConnectDevicePlugin/dConnectDeviceHost/dConnectDeviceHost/Classes/profile/DPHostNotificationProfile.m +++ b/dConnectDevicePlugin/dConnectDeviceHost/dConnectDeviceHost/Classes/profile/DPHostNotificationProfile.m @@ -52,9 +52,10 @@ - (instancetype)init _notificationInfoDict = @{}.mutableCopy; [self setNotificationIdLength: 3]; - - UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; - center.delegate = self; + dispatch_async(dispatch_get_main_queue(), ^{ + UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; + center.delegate = self; + }); // API登録(didReceivePostNotifyRequest相当) NSString *postNotifyRequestApiPath = [self apiPath: nil diff --git a/dConnectDevicePlugin/dConnectDeviceSonyCamera/dConnectDeviceSonyCamera/Classes/SonyCameraManager.m b/dConnectDevicePlugin/dConnectDeviceSonyCamera/dConnectDeviceSonyCamera/Classes/SonyCameraManager.m index b418cac2..4d7dc963 100644 --- a/dConnectDevicePlugin/dConnectDeviceSonyCamera/dConnectDeviceSonyCamera/Classes/SonyCameraManager.m +++ b/dConnectDevicePlugin/dConnectDeviceSonyCamera/dConnectDeviceSonyCamera/Classes/SonyCameraManager.m @@ -384,7 +384,7 @@ - (void) setZoomByDirection:(NSString *)direction __block typeof(self) weakSelf = self; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - NSString *tmpMovement = movement; + NSString *tmpMovement = [movement stringByReplacingOccurrencesOfString:@"in-" withString:@""]; if ([movement isEqualToString:@"max"]) { tmpMovement = @"start"; } diff --git a/dConnectDevicePlugin/dConnectDeviceTheta/dConnectDeviceTheta/Classes/DPOmnidirectionalImageProfile.m b/dConnectDevicePlugin/dConnectDeviceTheta/dConnectDeviceTheta/Classes/DPOmnidirectionalImageProfile.m index b14582e2..a98ee0f5 100644 --- a/dConnectDevicePlugin/dConnectDeviceTheta/dConnectDeviceTheta/Classes/DPOmnidirectionalImageProfile.m +++ b/dConnectDevicePlugin/dConnectDeviceTheta/dConnectDeviceTheta/Classes/DPOmnidirectionalImageProfile.m @@ -2,10 +2,12 @@ // DPOmnidirectionalImageProfile.m // dConnectDeviceTheta // -// Created by 星 貴之 on 2015/08/23. -// Copyright (c) 2015年 DOCOMO. All rights reserved. +// Copyright (c) 2015 NTT DOCOMO, INC. +// Released under the MIT license +// http://opensource.org/licenses/mit-license.php // + #import "DPOmnidirectionalImageProfile.h" NSString *const DPOmnidirectionalImageProfileName = @"omnidirectionalImage"; diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/accordion.css b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/accordion.css index 90ea45b7..3e137303 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/accordion.css +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/accordion.css @@ -27,6 +27,7 @@ img.plus { .ac_menu div.ac_content { box-shadow:0px 1px 5px #AAA inset; + border-bottom: thin solid #558BCA; background :#f4f4f4; -webkit-transition: all 0.5s; -moz-transition: all 0.5s; diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/checker.css b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/checker.css index b256732e..4ecf1e88 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/checker.css +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/checker.css @@ -3,6 +3,15 @@ body { margin: 0px; padding: 0px; } +div.title { + background-color: #5B9CFC; + padding: 10px; + font-weight: bold; + color: #FFFFFF; +} +a.back{ + color:#FFFFFF; +} div.request_param { padding: 12px 8px 8px 8px; @@ -200,12 +209,31 @@ div.test { input, select { vertical-align: middle; } -div.title { - background-color: #5B9CFC; - padding: 10px; - font-weight: bold; - color: #FFFFFF; + +label { + animation-name: fadeIn; + animation-duration: 0.3s; + animation-iteration-count: 1; + animation-timing-function: ease-out; + animation-fill-mode: backwards; } -a.back{ - color:#FFFFFF; + +.ac_menu div.ac_content { + animation-name: fadeIn; + animation-duration: 0.3s; + animation-iteration-count: 1; + animation-timing-function: ease-out; + animation-fill-mode: backwards; +} + +@keyframes fadeIn { + from { + transform:translateY(300px); + opacity: 0.0; + } + + to { + transform:translateY(0px); + opacity: 1.0; + } } diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/index.css b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/index.css index 06619852..dbc7be33 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/index.css +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/index.css @@ -6,6 +6,15 @@ body { background-color: #FBFBFB; } +div.title { + background-color: #5B9CFC; + padding: 10px; + font-weight: bold; + color: #FFFFFF; +} +a.back{ + color:#FFFFFF; +} img.icon { width: 42px; @@ -38,20 +47,28 @@ div.profileName { border-right: solid 1px #E5E5E5; box-shadow: 0px 0px 2px #F3F3F3; color: #5B9CFC; -} + animation-name: fadeIn; + animation-duration: 0.3s; + animation-iteration-count: 1; + animation-timing-function: cubic-bezier(0, 1.1, 1, 1.1); + animation-fill-mode: backwards; +} a { text-decoration: none; } a:link { color: #5B9CFC; } a:visited { color: #5B9CFC; } a:hover { color: #5B9CFC; } a:active { color: #5B9CFC; } -div.title { - background-color: #5B9CFC; - padding: 10px; - font-weight: bold; - color: #FFFFFF; -} -a.back{ - color:#FFFFFF; + +@keyframes fadeIn { + from { + transform: scale(0.0, 0.0); + opacity: 0.0; + } + + to { + transform: scale(1.0, 1.0); + opacity: 1.0; + } } diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/resource.css b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/resource.css index b458c30d..cebd992e 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/resource.css +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/resource.css @@ -10,3 +10,4 @@ div.title { a.back{ color:#FFFFFF; } + diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/index.html b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/index.html index 1afd794c..f566b128 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/index.html +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/index.html @@ -17,7 +17,7 @@ @@ -11,12 +11,12 @@ 加速度センサー -
- -
-
加速度センサー
+
+ +
+
加速度センサー
- +
diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/demo_battery.html b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/demo_battery.html index fea8e7af..2c83c894 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/demo_battery.html +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/demo_battery.html @@ -1,8 +1,8 @@ - + @@ -10,12 +10,12 @@ バッテリー -
- -
-
バッテリー
+
+ +
+
バッテリー
- +
diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/demo_take_photo.html b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/demo_take_photo.html index 9e2dd733..f2acc022 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/demo_take_photo.html +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/demo_take_photo.html @@ -1,30 +1,45 @@ - + + 写真を撮影する -
- -
-
写真を撮影する
+
+ +
+
写真を撮影する
- - - + + + + + + + + + + + + + +
ターゲット:
撮影サイズ:
プレビューサイズ:
-
- -
- +
+
+ +
+
+
-
diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/demo_vibration.html b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/demo_vibration.html index 2f0abab4..0df7318c 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/demo_vibration.html +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/demo_vibration.html @@ -1,8 +1,8 @@ - + @@ -10,28 +10,12 @@ バイブレーション -
+
-
バイブレーション
+
バイブレーション
- - - +
diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/images/take_photo_1.png b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/images/take_photo_1.png new file mode 100644 index 00000000..6d6b018d Binary files /dev/null and b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/images/take_photo_1.png differ diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/dconnectsdk-2.2.0.js b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/dconnectsdk-2.2.0.js index 83b17806..22d14691 100755 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/dconnectsdk-2.2.0.js +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/dconnectsdk-2.2.0.js @@ -991,14 +991,14 @@ var dConnect = (function(parent, global) { }, /** - * Settingプロファイルの定数 + * Settingsプロファイルの定数 * @namespace * @type {Object.} */ - setting: { + settings: { // Profile name /** プロファイル名。 */ - PROFILE_NAME: 'setting', + PROFILE_NAME: 'settings', // Interface /** インターフェース: sound */ @@ -1011,8 +1011,8 @@ var dConnect = (function(parent, global) { ATTR_VOLUME: 'volume', /** アトリビュート: date */ ATTR_DATE: 'date', - /** アトリビュート: brightness */ - ATTR_BRIGHTNESS: 'brightness', + /** アトリビュート: light */ + ATTR_LIGHT: 'light', /** アトリビュート: sleep */ ATTR_SLEEP: 'sleep', @@ -1170,47 +1170,6 @@ var dConnect = (function(parent, global) { /** モードフラグ:フィルモード */ MODE_FILLS: 'fills' - }, - - /** - * Geolocationプロファイルの定数 - * @namespace - * @type {Object.} - */ - geolocation: { - // Profile name - /** プロファイル名。 */ - PROFILE_NAME: 'geolocation', - - // Attribute - /** アトリビュート: currentposition */ - ATTR_CURRENT_POSITION: 'currentposition', - /** アトリビュート: onwatchposition */ - ATTR_ON_WATCH_POSITION: 'onwatchposition', - - // Parameter - /** パラメータ: position */ - PARAM_POSITION: 'position', - /** パラメータ: coordinates */ - PARAM_COORDINATES: 'coordinates', - /** パラメータ: latitude */ - PARAM_LATITUDE: 'latitude', - /** パラメータ: longitude */ - PARAM_LONGNITUDE: 'longitude', - /** パラメータ: altitude */ - PARAM_ALTITUDE: 'altitude', - /** パラメータ: accuracy */ - PARAM_ACCURACY: 'accuracy', - /** パラメータ: altitudeAccuracy */ - PARAM_ALTITUDE_ACCURACY: 'altitudeAccuracy', - /** パラメータ: heading */ - PARAM_HEADING: 'heading', - /** パラメータ: speed */ - PARAM_SPEED: 'speed', - /** パラメータ: timeStamp */ - PARAM_TIME_STAMP: 'timeStamp', - /** パラメータ: timeStampString */ - PARAM_TIME_STAMP_STRING: 'timeStampString' } }; parent.constants = constants; diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_acceleration.js b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_acceleration.js index 3ff8670b..f453a1ef 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_acceleration.js +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_acceleration.js @@ -7,7 +7,7 @@ var demoAcceleration = (function(parent, global) { var mTimerId; var mContext; - var mWidth = window.parent.screen.width / 1.5; + var mWidth = 380; var mHeight = 200; var mDataSize = mWidth / 4; @@ -21,7 +21,6 @@ var demoAcceleration = (function(parent, global) { if (!canvas || !canvas.getContext) { return false; } - document.getElementById("graph").width = mWidth; mContext = canvas.getContext('2d'); mContext.lineWidth = 1; drawGraph(); diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_battery.js b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_battery.js index 9534718b..173d3042 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_battery.js +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_battery.js @@ -56,6 +56,7 @@ var demoBattery = (function(parent, global) { builder.setAttribute('onchargingchange'); builder.setServiceId(mServiceId); builder.setAccessToken(util.getAccessToken()); + builder.setSessionKey(util.getSessionKey()); var uri = builder.build(); dConnect.addEventListener(uri, function(message) { @@ -73,6 +74,7 @@ var demoBattery = (function(parent, global) { builder.setAttribute('onbatterychange'); builder.setServiceId(mServiceId); builder.setAccessToken(util.getAccessToken()); + builder.setSessionKey(util.getSessionKey()); var uri = builder.build(); dConnect.addEventListener(uri, function(message) { diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_take_photo.js b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_take_photo.js index 1040bbbe..2315daba 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_take_photo.js +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_take_photo.js @@ -4,6 +4,7 @@ var demoTakePhoto = (function(parent, global) { var mMediaRecorders; var mImageSizes; var mPreviewSizes; + var mPreviewTarget; function init() { util.init(function(service) { @@ -13,11 +14,8 @@ var demoTakePhoto = (function(parent, global) { } parent.init = init; - function refreshImg(uri, id) { - var img = document.getElementById(id); - if (img) { - img.src = uri + '?' + Date.now(); - } + function refreshImg(uri) { + document.body.style.backgroundImage = 'url(' + uri + ')'; } function getCameraTarget() { @@ -31,7 +29,7 @@ var demoTakePhoto = (function(parent, global) { mMediaRecorders = json.recorders; createMediaRecorders(); }, function(errorCode, errorMessage) { - util.showAlert("カメラ情報の取得に失敗しました。。", errorCode, errorMessage); + util.showAlert('カメラ情報の取得に失敗しました。。', errorCode, errorMessage); }); } @@ -49,18 +47,10 @@ var demoTakePhoto = (function(parent, global) { mImageSizes = json.imageSizes; mPreviewSizes = json.previewSizes; createOptions(); + onStartPreview(); }, function(errorCode, errorMessage) { - var imageSizes = document.recorder.imageSize; - var iOption = document.createElement('option'); - iOption.setAttribute('value', '0'); - iOption.innerHTML = 'Unsupported size'; - imageSizes.appendChild(iOption); - var previewSizes = document.recorder.previewSize; - var pOption = document.createElement('option'); - pOption.setAttribute('value', '0'); - pOption.innerHTML = 'Unsupported size'; - previewSizes.appendChild(pOption); - util.showAlert("カメラ情報の取得に失敗しました。。", errorCode, errorMessage); + util.showAlert('カメラ情報の取得に失敗しました。。', errorCode, errorMessage); + onStartPreview(); }); } @@ -80,10 +70,10 @@ var demoTakePhoto = (function(parent, global) { function createOptions() { var minWidth = 10000000; var imageSizes = document.recorder.imageSize; - for (var i = 0; i < mMediaRecorders.length; i++) { + for (var i = 0; i < mImageSizes.length; i++) { var option = document.createElement('option'); option.setAttribute('value', i); - option.innerHTML = mImageSizes[i].width + "x" + mImageSizes[i].height; + option.innerHTML = mImageSizes[i].width + 'x' + mImageSizes[i].height; if (mImageSizes[i].width < minWidth) { option.selected = true; @@ -98,22 +88,15 @@ var demoTakePhoto = (function(parent, global) { for (var i = 0; i < mPreviewSizes.length; i++) { var option = document.createElement('option'); option.setAttribute('value', i); - option.innerHTML = mPreviewSizes[i].width + "x" + mPreviewSizes[i].height; + option.innerHTML = mPreviewSizes[i].width + 'x' + mPreviewSizes[i].height; if (mPreviewSizes[i].width < minWidth) { option.selected = true; - minWidth = mImageSizes[i].width + minWidth = mPreviewSizes[i].width } previewSizes.appendChild(option); } - if (mMediaRecorders.length == 0) { - var option = document.createElement('option'); - option.setAttribute('value', 'Unsupported size'); - previewSizes.appendChild(option); - } - - startPreview(); } function startPreview() { @@ -129,14 +112,14 @@ var demoTakePhoto = (function(parent, global) { } var uri = builder.build(); dConnect.put(uri, null, null, function(json) { - refreshImg(json.uri, 'preview'); + refreshImg(json.uri); }, function(errorCode, errorMessage) { - util.showAlert("プレビュー開始に失敗しました。", errorCode, errorMessage); + util.showAlert('プレビュー開始に失敗しました。', errorCode, errorMessage); }); } function stopPreview(callback) { - var target = document.recorder.target.value; + var target = mPreviewTarget; var builder = new dConnect.URIBuilder(); builder.setProfile('mediastreamrecording'); @@ -152,23 +135,42 @@ var demoTakePhoto = (function(parent, global) { setTimeout(callback, 2000); } }, function(errorCode, errorMessage) { - util.showAlert("プレビュー停止に失敗しました。", errorCode, errorMessage); + console.log('プレビュー停止に失敗しました。' + errorCode + ":" + errorMessage); }); } + function showPhoto(uri) { + var elem = document.getElementById('photos'); + elem.style.display = 'block'; + elem.onclick = function() { + elem.style.display = 'none'; + }; + + var image = document.getElementById('photo'); + image.setAttribute('src', uri); + } + + function onClickPhoto(elem) { + var uri = elem.getAttribute("src") + showPhoto(uri); + } + function addPhoto(uri) { - var elem = document.createElement("img"); - elem.setAttribute("src", uri); - elem.setAttribute("class", "photo") - elem.setAttribute("crossorigin", "anonymous") - elem.setAttribute("alt", "写真"); + var elem = document.createElement('img'); + elem.setAttribute('src', uri); + elem.setAttribute('class', 'thumbnail') + elem.setAttribute('crossorigin', 'anonymous') + elem.setAttribute('alt', '写真'); + elem.onclick = function() { + showPhoto(uri); + }; - var tag = document.getElementById('photos'); + var tag = document.getElementById('thumbnails'); tag.appendChild(elem); } function onTakePhoto() { - var target = document.recorder.target.value; + var target = mPreviewTarget; var builder = new dConnect.URIBuilder(); builder.setProfile('mediastreamrecording'); @@ -180,13 +182,32 @@ var demoTakePhoto = (function(parent, global) { } var uri = builder.build(); dConnect.post(uri, null, null, function(json) { - refreshImg(json.uri, 'preview'); + addPhoto(json.uri); }, function(errorCode, errorMessage) { - util.showAlert("撮影に失敗しました。", errorCode, errorMessage); + util.showAlert('撮影に失敗しました。', errorCode, errorMessage); }); } parent.onTakePhoto = onTakePhoto; + function onStartPreview() { + if (mPreviewTarget) { + stopPreview(function() { + mPreviewTarget = document.recorder.target.value; + startPreview(); + }); + } else { + mPreviewTarget = document.recorder.target.value; + startPreview(); + } + } + parent.onStartPreview = onStartPreview; + + function onStopPreview() { + stopPreview(null); + mPreviewTarget = undefined; + } + parent.onStopPreview = onStopPreview; + function onChangeTarget() { var target = document.recorder.target.value; getCameraOption(target); @@ -218,16 +239,31 @@ var demoTakePhoto = (function(parent, global) { builder.addParameter('imageHeight', imageHeight); builder.addParameter('previewWidth', previewWidth); builder.addParameter('previewHeight', previewHeight); - builder.addParameter('mimeType', "image/png"); + builder.addParameter('mimeType', 'image/png'); var uri = builder.build(); dConnect.put(uri, null, null, function(json) { - startPreview(); + if (mPreviewTarget) { + startPreview(); + } }, function(errorCode, errorMessage) { - util.showAlert("設定に失敗しました。", errorCode, errorMessage); + util.showAlert('設定に失敗しました。', errorCode, errorMessage); }); }); } parent.onChangeOption = onChangeOption; + + function backLink() { + stopPreview(function() { + history.back(); + }); + } + parent.backLink = backLink; + + window.onbeforeunload = function(e) { + onStopPreview(); + return; + }; + return parent; })(demoTakePhoto || {}, this.self || global); diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_vibration.js b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_vibration.js index fa0ebf46..d6c4ad70 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_vibration.js +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/demo_vibration.js @@ -24,10 +24,8 @@ var demoVibration = (function(parent, global) { builder.setAttribute('vibrate'); builder.setServiceId(mServiceId); builder.setAccessToken(util.getAccessToken()); -// builder.addParameter('pattern', getVibrationPattern()); var uri = builder.build(); dConnect.put(uri, null, null, function(json) { - console.log(json); }, function(errorCode, errorMessage) { util.showAlert("バイブレーションの開始に失敗しました。", errorCode, errorMessage); }); diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/util.js b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/util.js index 2433cec1..abe6990f 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/util.js +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/demo/js/util.js @@ -71,20 +71,15 @@ var util = (function(parent, global) { } function openWebSocketIfNeeded() { - try { - if (!dConnect.isConnectedWebSocket()) { - var accessToken = mAccessToken ? mAccessToken : mSessionKey; - dConnect.connectWebSocket(accessToken, function(code, message) { - if (code > 0) { - alert('WebSocketが切れました。\n code=' + code + " message=" + message); - } - console.log("WebSocket: code=" + code + " message=" +message); - }); - } - } catch (e) { - alert("この端末は、WebSocketをサポートしていません。"); + if (!dConnect.isConnectedWebSocket()) { + var accessToken = mAccessToken ? mAccessToken : mSessionKey; + dConnect.connectWebSocket(accessToken, function(code, message) { + if (code > 0) { + alert('WebSocketが切れました。\n code=' + code + " message=" + message); + } + console.log("WebSocket: code=" + code + " message=" +message); + }); } - } function findHostDevicePlugin(callback) { diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/host_install.html b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/host_install.html deleted file mode 100644 index 48be8490..00000000 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/host_install.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - HOSTプラグインのインストール - - -
HOSTプラグインのインストール
-
- -
- - diff --git a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/host_tutorial.html b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/host_tutorial.html index b2121442..b3e38079 100644 --- a/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/host_tutorial.html +++ b/dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/help/tutorial/host_tutorial.html @@ -1,23 +1,26 @@ - + - HOSTプラグインを利用する + HOSTデバイスプラグインを利用する -
+
-
HOSTプラグインを利用する
+
HOSTデバイスプラグインを利用する
+