# HTML5 media.hasSource unhandling error

**URL:** <https://forums.solar2d.com/t/html5-media-hassource-unhandling-error/356769>\
**Category:** HTML5\
**Created:** [August 25, 2024, 11:34am UTC](https://forums.solar2d.com/t/html5-media-hassource-unhandling-error/356769 "2024-08-25T11:34:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirill1209102](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@kirill1209102](https://forums.solar2d.com/u/kirill1209102)\
**Post date:** [August 25, 2024, 11:34am UTC](https://forums.solar2d.com/t/html5-media-hassource-unhandling-error/356769/1 "2024-08-25T11:34:52Z")

</div>

I`ve got unhandled error when I use media.hasSource like this:

```auto
local hasAccessToPhotos, hasPhotos = media.hasSource( media.PhotoLibrary )

if (hasAccessToPhotos) then
     media.selectPhoto({mediaSource=media.PhotoLibrary, listener = loadingComplete})
end

```

In JS MediaDevices.getUserMedia() can be used only in https connections. In other way user will get this exceptions:

```auto
Error: MediaRecorder requires getUserMedia supported

```

Runtime:addEventListener( “unhandledError”) cannot catch this exception

Is there any best practise?

P.S. for better understanding: in this case “hasAccessToPhotos” and “hasPhotos” is both “true”
