mirror of
https://github.com/DmcSDK/cordova-plugin-mediaPicker
synced 2026-05-22 00:01:31 +08:00
Update readme.md
This commit is contained in:
@@ -29,7 +29,7 @@ html code:
|
||||
</div>
|
||||
<button id="openBtn">open</button>
|
||||
<button id="uploadBtn">upload</button>
|
||||
|
||||
<button id="takePhotoBtn">takePhoto</button>
|
||||
<script type="text/javascript" src="cordova.js"></script>
|
||||
<script type="text/javascript" src="js/index.js"></script>
|
||||
</body>
|
||||
@@ -95,6 +95,22 @@ document.addEventListener("MediaPicker.CompressVideoEvent", function(data) {
|
||||
}, false);
|
||||
```
|
||||
|
||||
### takePhoto 拍照
|
||||
please add : cordova plugin add cordova-plugin-camera
|
||||
index.js **takePhoto** code:
|
||||
```
|
||||
//please add : cordova plugin add cordova-plugin-camera
|
||||
document.getElementById('takePhotoBtn').onclick = function() {
|
||||
//cameraOptions docs https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-camera/index.html#camera
|
||||
var cameraOptions={ quality: 25,mediaType: Camera.MediaType.PICTURE };
|
||||
MediaPicker.takePhoto(function(media) {
|
||||
media.index=0;//index use to imgs[data.index].src; // media.index=resultMedias.length;
|
||||
resultMedias.push(media);
|
||||
getThumbnail(resultMedias);
|
||||
}, function(e) { console.log(e) }, cameraOptions);
|
||||
};
|
||||
```
|
||||
|
||||
# More api 其他API
|
||||
[API](https://github.com/DmcSDK/cordova-plugin-mediaPicker/blob/master/www/MediaPicker.js) https://github.com/DmcSDK/cordova-plugin-mediaPicker/blob/master/www/MediaPicker.js</br>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user