# Screen Sharing Error Loop \[VueJS\]

**URL:** <https://openvidu.discourse.group/t/screen-sharing-error-loop-vuejs/2780>\
**Category:** Issues developing apps\
**Tags:** v2\
**Created:** [March 4, 2021, 7:53pm UTC](https://openvidu.discourse.group/t/screen-sharing-error-loop-vuejs/2780 "2021-03-04T19:53:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrsaucedo](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/jrsaucedo/32/1335_2.png) [@jrsaucedo](https://openvidu.discourse.group/u/jrsaucedo)\
**Post date:** [March 4, 2021, 7:53pm UTC](https://openvidu.discourse.group/t/screen-sharing-error-loop-vuejs/2780/1 "2021-03-04T19:53:55Z")

</div>

I start my session with webcam:  
Then try share my screen whit this code:  
async screenShare () {  
const token = await this.createToken(this.idClase)  
console.log(token)  
this.session  
.connect(token).then(() =\> {  
const videoSource = navigator.userAgent.indexOf(‘Firefox’) !== -1 ? ‘window’ : ‘screen’  
const publisher = this.OV.initPublisher(  
undefined,  
{  
videoSource: videoSource,  
publishAudio: true,  
publishVideo: true,  
mirror: false  
}, (error) =\> {  
if (error) {  
console.error('Error while initializing publisher: ', error)  
} else {  
console.log(‘Publisher successfully initialized’)  
}

```
              if (error && error.name === 'SCREEN_EXTENSION_NOT_INSTALLED') {
                this.setState({ showExtensionDialog: true })
              } else if (error && error.name === 'SCREEN_SHARING_NOT_SUPPORTED') {
                alert('Your browser does not support screen sharing')
              } else if (error && error.name === 'SCREEN_EXTENSION_DISABLED') {
                alert('You need to enable screen sharing extension')
              } else if (error && error.name === 'SCREEN_CAPTURE_DENIED') {
                this.session.unpublish(publisher)
                alert('You need to choose a window or application to share')
              }
            }
          )
          publisher.once('accessAllowed', () => {
            publisher.stream.getMediaStream().addEventListener('ended', () => {
              console.log('ENDED: User pressed the "Stop sharing" button')
              this.sharingScreen = false
              this.session.unpublish(this.screenPublisher)
              this.screenPublisher = undefined
            })
            publisher.stream.getMediaStream().addEventListener('inactive', () => {
              console.log('INACTIVE: User pressed the "Stop sharing" button')
              this.sharingScreen = false
              this.session.unpublish(this.screenPublisher)
              this.screenPublisher = undefined
            })
            this.session.unpublish(this.publisher)
            this.screenPublisher = publisher
            this.session.publish(publisher)
            this.sharingScreen = true
          })
          publisher.once('streamPlaying', () => {
            console.log('Streaming:', publisher)
          })
        }).catch((error) => {
          console.log(
            'There was an error connecting screen share:',
            error.code,
            error.message
          )
        })
    },

```

But create another camera connection.
