Я пытаюсь заставить плагин Cordova Camera для возврата изображения, но он возвращает только 20 вместо допустимого URI файла, вот код, который я использую. Не то чтобы это работало с предыдущими версиями Android, но не с 34. async function getURIFromCamera (source = 1) {
return new Promise((resolve, reject) => {
if (!navigator.camera) {
console.error('Camera plugin is not available')
alert('Camera plugin is not available')
reject(new Error('Camera plugin not available'))
return
}
const camera = navigator.camera
const options = {
quality: 50,
sourceType: source,
destinationType: camera.DestinationType.FILE_URI,
encodingType: camera.EncodingType.JPEG,
mediaType: camera.MediaType.PICTURE,
saveToPhotoAlbum: true,
correctOrientation: true
}
function showError (error) {
console.error('Camera error:', error)
alert('Camera error: ' + error)
reject(error)
}
camera.getPicture(
imageURI => {
alert(imageURI)
resolve(imageURI)
},
showError,
options
)
})
}
< /code>
И вот мой манифест < /p>
````
you can see that I have the required permissions to access the camera, so I shouldn't have this error.
I have to add some extra information otherwise this stupid editor will not allow me to post my question even though I have said what I needed to say. Sorry for that guys and, but that is what happens when you use stupid AI engines.
Подробнее здесь: https://stackoverflow.com/questions/797 ... returns-20
Camera.getPicture возвращает 20 ⇐ Android
Форум для тех, кто программирует под Android
1754573958
Anonymous
Я пытаюсь заставить плагин Cordova Camera для возврата изображения, но он возвращает только 20 вместо допустимого URI файла, вот код, который я использую. Не то чтобы это работало с предыдущими версиями Android, но не с 34. async function getURIFromCamera (source = 1) {
return new Promise((resolve, reject) => {
if (!navigator.camera) {
console.error('Camera plugin is not available')
alert('Camera plugin is not available')
reject(new Error('Camera plugin not available'))
return
}
const camera = navigator.camera
const options = {
quality: 50,
sourceType: source,
destinationType: camera.DestinationType.FILE_URI,
encodingType: camera.EncodingType.JPEG,
mediaType: camera.MediaType.PICTURE,
saveToPhotoAlbum: true,
correctOrientation: true
}
function showError (error) {
console.error('Camera error:', error)
alert('Camera error: ' + error)
reject(error)
}
camera.getPicture(
imageURI => {
alert(imageURI)
resolve(imageURI)
},
showError,
options
)
})
}
< /code>
И вот мой манифест < /p>
````
you can see that I have the required permissions to access the camera, so I shouldn't have this error.
I have to add some extra information otherwise this stupid editor will not allow me to post my question even though I have said what I needed to say. Sorry for that guys and, but that is what happens when you use stupid AI engines.
Подробнее здесь: [url]https://stackoverflow.com/questions/79728664/camera-getpicture-returns-20[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия