Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Provide Vue example of Audio Native component (like React guide) #27

Open
dosstx opened this issue May 19, 2024 · 2 comments

Comments

@dosstx
Copy link

dosstx commented May 19, 2024

Please provide a Vue (or Nuxt) example for integrating Audio Native using API method. I'm trying to convert the react version you have, but not much luck at the moment. Thank you.

@thijsw
Copy link

thijsw commented May 28, 2024

Something like this?

<template>
  <div
    id="elevenlabs-audionative-widget"
    :data-height="size === 'small' ? '90' : '120'"
    data-width="100%"
    data-frameborder="no"
    data-scrolling="no"
    :data-publicuserid="publicUserId"
    data-playerurl="https://elevenlabs.io/player/index.html"
    :data-small="size === 'small' ? 'True' : 'False'"
    :data-textcolor="textColorRgba ?? 'rgba(0, 0, 0, 1.0)'"
    :data-backgroundcolor="backgroundColorRgba ?? 'rgba(255, 255, 255, 1.0)'"
  >
    <slot />
  </div>
</template>

<script lang="ts" setup>
import type { PropType } from 'vue'

defineProps({
  publicUserId: {
    type: String,
    required: true
  },

  textColorRgba: {
    type: String,
    required: false
  },

  backgroundColorRgba: {
    type: String,
    required: false
  },

  size: {
    type: String as PropType<'small' | 'large'>,
    required: false
  }
})

useHead({
  script: [
    {
      src: 'https://elevenlabs.io/player/audioNativeHelper.js',
      async: true,
      tagPosition: 'bodyClose'
    }
  ]
})
</script>

@dosstx
Copy link
Author

dosstx commented May 28, 2024

Thank you. I'll give it a try and report back:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants