# Pespective device camera access, how to access?

**URL:** <https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [May 11, 2022, 1:09pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455 "2022-05-11T13:09:28Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 11, 2022, 1:09pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/1 "2022-05-11T13:09:28Z")

</div>

Good day! How do you access the devices’ camera through the perspective page?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 11, 2022, 1:18pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/2 "2022-05-11T13:18:42Z")

</div>

What are you trying to accomplish?

Access to the camera is limited to use cases like barcode scanning and only available when running one of the Perspective mobile apps.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 11, 2022, 1:27pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/3 "2022-05-11T13:27:05Z")

</div>

i want to scan barcodes, like you suggest.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 11, 2022, 1:36pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/4 "2022-05-11T13:36:39Z")

</div>

It looks like you use the [Barcode Scanned session event](https://docs.inductiveautomation.com/display/DOC81/Perspective+Session+Event+Scripts#PerspectiveSessionEventScripts-BarcodeScanned) along with the [Scan Barcode action](https://docs.inductiveautomation.com/display/DOC81/Component+Events+and+Actions#ComponentEventsandActions-ScanBarcodeAction).

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 11, 2022, 2:21pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/5 "2022-05-11T14:21:28Z")

</div>

Thanks Kevin, all that was really useful. I am also interested in being able to scan a QR code that houses a URL. Can I navigate to that URL from here?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 11, 2022, 3:36pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/6 "2022-05-11T15:36:20Z")

</div>

Yes, in the barcode scanned event you can just invoke `system.perspective.navigate`:  
[https://docs.inductiveautomation.com/display/DOC81/system.perspective.navigate](https://docs.inductiveautomation.com/display/DOC81/system.perspective.navigate)

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 11, 2022, 5:25pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/7 "2022-05-11T17:25:56Z")

</div>

Thanks PGriffith, when I use the script

```auto
system.perspective.navigate(url = 'self.getSibling("Label").props.text')

```

which is this url, -[https://inductiveautomation.com/ignition/maker-edition-](https://inductiveautomation.com/ignition/maker-edition-), it says “view not found”, do I need to have a web browser module for perspective? \*i had to put the - before and after the url here so it wouldnt create shortcut link

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 11, 2022, 5:36pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/8 "2022-05-11T17:36:47Z")

</div>

Don’t wrap it in quotes.  
`system.perspective.navigate(url = 'self.getSibling("Label").props.text')`  
Means "send me to the url `'self.getSibling("Label").props.text'`".

`system.perspective.navigate(url = self.getSibling("Label").props.text)`  
Means "send me to the url with a text value specified by `self.getSibling("Label").props.text`".

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 11, 2022, 5:50pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/9 "2022-05-11T17:50:30Z")

</div>

when I do

```auto
system.perspective.navigate(url = self.getSibling("Label").props.text)

```

I dont navigate anywhere

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 11, 2022, 6:06pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/10 "2022-05-11T18:06:11Z")

</div>

Where are you actually putting this script? Are there any errors in the gateway or browser logs?

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 11, 2022, 6:08pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/11 "2022-05-11T18:08:36Z")

</div>

Here is a pic of where im putting this script:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/5/a5499e66f42bf30c9c7f4351f94be63f8a33313f.png)

the error i get:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/d/4d322c00048946a0bdde9faf8074b0f978fb7975.png)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 11, 2022, 6:15pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/12 "2022-05-11T18:15:53Z")

</div>

This code is in a session event, and doesn’t have a `self` argument defined. The `self.getSibling()` is intended to be called from another component on the same view as `Label`.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 11, 2022, 6:36pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/13 "2022-05-11T18:36:38Z")

</div>

I see what you mean, I changed it to this now:

```auto
	system.tag.writeAsync(['[default]Barcode Data'], [data.text])
	system.perspective.navigate(url = '[default]Barcode Data')

```

I had to leave the ’ ’ on the script or it would say the syntax was wrong, like this:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/2/022a592f07aacc216688613ab7f565082c88cece.png)

this is the error i get now:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/1/7175ca1afe3ce0a081d147ccc606fb4e3bc30bea.png)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 11, 2022, 6:48pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/14 "2022-05-11T18:48:56Z")

</div>

I think you’re looking for this:

```auto
system.tag.writeAsync(['[default]Barcode Data'], [data])
system.perspective.navigate(url = data)

```

assuming that data is a valid URL. Also, not sure if `writeAsync` is really what you want, but it’s not hurting anything. Also, I’m not sure you can use `navigate` from this place.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 11, 2022, 9:17pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/15 "2022-05-11T21:17:10Z")

</div>

Instead of writing to a tag, you should be sending this through ad the `context` if that is coming from a label on the page. Unless of course the label text is bound to the barcode scan data?

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 12, 2022, 2:19pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/16 "2022-05-12T14:19:05Z")

</div>

I am unsure:

> [@nminchin](#):
>
> you should be sending this through ad the `context` if that is coming from a label on the page.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 12, 2022, 2:33pm UTC](https://forum.inductiveautomation.com/t/pespective-device-camera-access-how-to-access/59455/17 "2022-05-12T14:33:42Z")

</div>

> [@lrose](#):
>
> I’m not sure you can use `navigate` from this place.

I could not navigate from there. Not sure why but to get it to navigate, I added an extra button with the navigate script on it bindsed back to the prop.text of the label that the barcode scanned wrote to. For me, it works fine.

Thanks alot everyone.
