Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

20141030 html5j-firefox os-deviceapi

21,050 views

Published on

An overview of device controllable API of Firefox OS.

Published in: Technology
  • Dating for everyone is here: ❶❶❶ http://bit.ly/2F7hN3u ❶❶❶
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating direct: ❤❤❤ http://bit.ly/2F7hN3u ❤❤❤
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

20141030 html5j-firefox os-deviceapi

  1. 1. 'JSFGPY04رغ؎أ1* IUNMKفٓحزؿؓ٦ي鿇 .P[JMMB+BQBOذؙصٕؕو٦؛ذ؍ؚٝ 幠宏兰Ⱅ OTIJNJ[V!NP[JMMBKBQBOPSH
  2. 2. 幠宏兰Ⱅ׃׫׆ך׶׋׌ ˖ .P[JMMB+BQBO ذؙصٕؕو٦؛ذ؍ؚٝ ˖ IUNMKفٓحزؿؓ٦ي鿇 ˖ 䣒䥯纏㞢㣐㷕 佟瘻٥ًر؍،灇瑔猰 暴ⴽ灇瑔侄㆞ ˖ !DIJLPTLJ ˖ IUUQTTMJEFTIBSFOFUDIJLPTLJ
  3. 3. BCPVUNP[JMMB
  4. 4. FFiirreeffooxx を よろしくね!
  5. 5. ׅץג8FC䪮遭דדֹגְתׅ ネットワーク、電池 連絡帳 動画、音楽、SDカード 通信量管理 アプリ間連携 アプリの管理 ブラウザ 通知 、プッシュ通知 カメラ Marketplace FMラジオ、端末の設定 ホーム画面、壁紙 電話、SMS
  6. 6. manifest.webapp:アプリマニフェスト { name: My App, description: My elevator pitch goes here, launch_path: /index.html, type: privileged icons: { 128: /img/icon-128.png }, developer: { name: Your name or organization, url: http://your-homepage-here.org }, default_locale: ja } IUUQTEFWFMPQFSNP[JMMBPSHKBQQT.BOJGFT IUUQTEFWFMPQFSNP[JMMBPSHKBQQT.BOJGFT
  7. 7. ⴓ겲 铡僇 鸐䌢،فٔ 鸐䌢ך،فٔկ مأز㘗ծػح؛٦آ㘗ה׮חֿך埄ꣲד⹛⡲ׅ׷կ 暴埄،فٔ 1SJWJMFHFE ػح؛٦آ㘗،فٔך׫կ鸐䌢،فٔ״׶⢪欽דֹ׷ 1*ָ㟓ִ׷կ؝٦سٖؽُ٦ח״׷㻢叨ָ遤׻׸ծ .BSLFUQMBDFח״׏גرآةٕ縭せָ➰⸇ׁ׸׷կ 钠㹀،فٔ $FSUJFE ػح؛٦آ㘗،فٔך׫կⰋגך1*ָⵃ欽דֹ׷կ ٍؗٔ،ծ׮׃ֻכ׉׸ח彊ׄ׷⚺⡤ך׫ָ⡲䧭〳腉կ ءأذي،فٔזוָ㼎韋կ
  8. 8. ⴓ겲 铡僇 鸐䌢،فٔ 鸐䌢ך،فٔկ مأز㘗ծػح؛٦آ㘗ה׮חֿך埄ꣲד⹛⡲ׅ׷կ 暴埄،فٔ 1SJWJMFHFE ػح؛٦آ㘗،فٔך׫կ鸐䌢،فٔ״׶⢪欽דֹ׷ 1*ָ㟓ִ׷կ؝٦سٖؽُ٦ח״׷㻢叨ָ遤׻׸ծ .BSLFUQMBDFח״׏גرآةٕ縭せָ➰⸇ׁ׸׷կ 钠㹀،فٔ $FSUJFE ػح؛٦آ㘗،فٔך׫կⰋגך1*ָⵃ欽דֹ׷կ ٍؗٔ،ծ׮׃ֻכ׉׸ח彊ׄ׷⚺⡤ך׫ָ⡲䧭〳腉կ ءأذي،فٔזוָ㼎韋կ
  9. 9. رغ؎أ1*
  10. 10. 㼎韋'JSFGPY04
  11. 11. .BSLFUQMBDFדꂁ䋒דֹ׷،فٔ
  12. 12. رغ؎أ1* ˖ /FUXPSL *OGPSNBUJPO ˖ .PCJMF/FUXPSL ˖ NCJFOU-JHIU 4FOTPS ˖ #BUUFSZ4UBUVT ˖ (FP-PDBUJPO ˖ 1SPYJNJUZ ˖ %FWJDF0SJFOUBUJPO ˖ 4DSFFO0SJFOUBUJPO ˖ 7JCSBUJPO ˖ $BNFSB ˖ (FU6TFS.FEJB ˖ $POUBDUT ˖ %FWJDF4UPSBHF ˖ '.3BEJP ˖ VEJP$IBOOFMT ˖ 4QFBLFS$POUSPM
  13. 13. رغ؎أ1* ˖ /FUXPSL *OGPSNBUJPO ˖ .PCJMF/FUXPSL ˖ NCJFOU-JHIU 4FOTPS ˖ #BUUFSZ4UBUVT ˖ (FP-PDBUJPO ˖ 1SPYJNJUZ ˖ %FWJDF0SJFOUBUJPO ˖ 4DSFFO0SJFOUBUJPO ˖ 7JCSBUJPO ˖ $BNFSB ˖ (FU6TFS.FEJB ˖ $POUBDUT ˖ %FWJDF4UPSBHF ˖ '.3BEJP ˖ VEJP$IBOOFMT ˖ 4QFBLFS$POUSPM
  14. 14. %FWJDF4UPSBHF IUUQTEFWFMPQFSNP[JMMBPSHEPDT8FC1*%FWJDF@4UPSBHF@1*
  15. 15. ر٦ةחさ׻ׇ׋珏겲ךأزٖ٦آ
  16. 16. manifest.webapp permissions: { device-storage:videos:{ access: readonly }, device-storage:pictures:{ access: readwrite } }
  17. 17. ファイル名が既知の場合の読み込み var sdcard = navigator.getDeviceStorage('sdcard'); var request = sdcard.get(my-file.txt); request.onsuccess = function () { var file = this.result; console.log(Get the file: + file.name); } request.onerror = function () { console.warn(Unable to get the file: + this.error); }
  18. 18. ファイルの書き出し var sdcard = navigator.getDeviceStorage(sdcard); var file = new Blob([This is a text file.], {type: text/plain}); var request = sdcard.addNamed(file, my-file.txt); request.onsuccess = function () { var name = this.result; console.log('File ' + name + ' successfully wrote on the sdcard storage area'); } // An error typically occur if a file with the same name already exist request.onerror = function () { console.warn('Unable to write the file: ' + this.error); }
  19. 19. ファイルの削除 var sdcard = navigator.getDeviceStorage('sdcard'); var request = sdcard.delete(my-file.txt); request.onsuccess = function () { console.log(File deleted); } request.onerror = function () { console.log(Unable to delete the file: + this.error); }
  20. 20. ストレージ内のファイル走査 var list = []; var storage = navigator.getDeviceStorage(music); var cursor = storage.enumerate(); cursor.onsuccess = function(){ var file = this.result; if(file.type == audio/mpeg){ list.push(file); } if(!this.done){ this.continue(); } }
  21. 21. ストレージサイズの取得 var videos = navigator.getDeviceStorage('videos'); var request = videos.usedSpace(); request.onsuccess = function () { // The result is express in bytes, lets turn it into megabytes var size = this.result / 1048576; console.log(The videos on your device use a total of + size.toFixed(2) + Mo of space.); } request.onerror = function () { console.warn(Unable to get the space used by videos: + this.error); }
  22. 22. (FU6TFS.FEJB IUUQTEFWFMPQFSNP[JMMBPSHEPDT8FC1*/BWJHBUPSHFU6TFS.FEJB
  23. 23. navigator.getUserMedia navigator.getUserMedia({ video: true, audio: false }, function(stream) { var vendorURL = window.URL || window.webkitURL; video.src = vendorURL.createObjectURL(stream); video.play(); }, function(err) { console.log(An error occured! + err); });
  24. 24. 写真の撮り方 function takepicture() { canvas.width = width; canvas.height = height; canvas.getContext('2d').drawImage(video, 0, 0, width, height); var data = canvas.toDataURL('image/png'); photo.setAttribute('src', data); }
  25. 25. $BNFSB IUUQTEFWFMPQFSNP[JMMBPSHEPDT8FC1*$BNFSB@1*
  26. 26. manifest.webapp permissions: { camera: { description: Required for accessing cameras on the device. } }
  27. 27. カメラの取得 var options = { mode: 'picture', recorderProfile: 'jpg', previewSize: { width: 352, height: 288 } }; var camera = navigator.mozCamera.getListOfCameras()[0]; function onSuccess(camera) { // Do stuff with the camera }; function onError(error) { console.warn(error); }; navigator.mozCamera.getCamera(camera, options, onSuccess, onError);
  28. 28. CameraControl var capabilities = camera.capabilities; camera.onShutter = function () { console.log(The camera is now turned off.); }; camera.onPreviewStateChange = onPreviewStateChange; camera.onRecorderStateChange = onRecorderStateChange;
  29. 29. $BNFSB$BQBCJMJUJFT ˖ $BNFSB$BQBCJMJUJFTFFDUT ˖ $BNFSB$BQBCJMJUJFTMF'PSNBUT ˖ $BNFSB$BQBCJMJUJFTBTI.PEFT ˖ $BNFSB$BQBCJMJUJFTGPDVT.PEFT ˖ $BNFSB$BQBCJMJUJFTNBYYQPTVSF$PNQFOTBUJPO ˖ $BNFSB$BQBCJMJUJFTNBY'PDVTSFBT ˖ $BNFSB$BQBCJMJUJFTNBY.FUFSJOHSFBT ˖ $BNFSB$BQBCJMJUJFTNJOYQPTVSF$PNQFOTBUJPO ˖ $BNFSB$BQBCJMJUJFTQJDUVSF4J[FT ˖ $BNFSB$BQBCJMJUJFTQSFWJFX4J[FT ˖ $BNFSB$BQBCJMJUJFTSFDPSEFS1SPMFT ˖ $BNFSB$BQBCJMJUJFTTDFOF.PEFT ˖ $BNFSB$BQBCJMJUJFTTUFQYQPTVSF$PNQFOTBUJPO ˖ $BNFSB$BQBCJMJUJFTWJEFP4J[FT ˖ $BNFSB$BQBCJMJUJFTXIJUF#BMBODF.PEFT ˖ $BNFSB$BQBCJMJUJFT[PPN3BUJPT
  30. 30. プレビュー画面の取得と表示 var display = document.querySelector(video); function onStreamReady( stream ) { display.mozSrcObject = stream; display.play(); } camera.getPreviewStream(size, onStreamReady);
  31. 31. 写真の撮影 function onPictureTaken( blob ) { storage.addNamed(blob, 'myImage.jpg'); } pictureOptions.pictureSize = camera.capabilities.pictureSizes[0]; pictureOptions.fileformat = camera.capabilities.fileFormats[0]; camera.takePicture(pictureOptions, onPictureTaken);
  32. 32. フィルタの設定 var capabilities = camera.capabilities; if (capablities.effects.indexOf('sepia') -1) { camera.effect = 'sepia'; }
  33. 33. '.3BEJP IUUQTEFWFMPQFSNP[JMMBPSHKBEPDT8FC1*'.3BEJP
  34. 34. 周波数の設定 var frequency = 99.1; var radio = navigator.mozFMRadio; if(radio.antennaAvailable){ // アンテナがある場合 radio.enable(frequency); // 周波数をセット }
  35. 35. ヘッドフォン脱着イベント var radio = navigator.mozFMRadio; radio.addEventListener(antennaavailablechange, function(){ var frequency = 99.1; if(radio.antennaAvailable){ radio.enable(frequency); // アンテナがある場合はラジオをON }else{ radio.disable(); //アンテナがない場合はラジオをOFF } });
  36. 36. 4QFBLFS.BOBHFS IUUQTXJLJNP[JMMBPSH8FC1*4QFBLFS.BOBHFS
  37. 37. スピーカー利用の強制 var sm = new MozSpeakerManager(); sm.forcespeaker = true; sm.onspeakerforcedchange = function() { // change views' state here };
  38. 38. תה׭
  39. 39. 8FCDUJWJUJFT IUUQTEFWFMPQFSNP[JMMBPSHEPDT8FC1*8FC@DUJWJUJFT
  40. 40. WebActivities var pick = MozActivity({ name : pick, data: { type: img/jpeg } }); pick.onsuccess = function(){ var result = this.result; // do something };
  41. 41. 4ZTUFN9)3 IUUQTEFWFMPQFSNP[JMMBPSHEPDT8FC1*9.-)UUQ3FRVFTU
  42. 42. 5$14PDLFU IUUQTEFWFMPQFSNP[JMMBPSHEPDT8FC1*5$14PDLFU
  43. 43. رغ؎أ1* ˖ /FUXPSL *OGPSNBUJPO ˖ .PCJMF/FUXPSL ˖ NCJFOU-JHIU 4FOTPS ˖ #BUUFSZ4UBUVT ˖ (FP-PDBUJPO ˖ 1SPYJNJUZ ˖ %FWJDF0SJFOUBUJPO ˖ 4DSFFO0SJFOUBUJPO ˖ 7JCSBUJPO ˖ $BNFSB ˖ (FU6TFS.FEJB ˖ $POUBDUT ˖ %FWJDF4UPSBHF ˖ '.3BEJP ˖ VEJP$IBOOFMT ˖ 4QFBLFS$POUSPM
  44. 44. IUUQTNBSLFUQMBDFGJSFGPYDPNEFWFMPQFST
  45. 45. IUUQTEFWFMPQFSNP[JMMBPSHBQQT
  46. 46. OKPZ

×