Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

105
Visualizações
How to manipulate a page with React Native WebView

I used react-native-webview to open the webpage, but the audio doesn't automatically stream/play until I press the button. Is there a way I can open the page and have it directly play or can I add a custom that plays the radio/audio on click?

import React from 'react'
import { View } from 'react-native'
import { WebView } from 'react-native-webview'

export default function Test() {
    const jsCode = "setTimeout(function() { const playButton = document.getElementsByClassName('jp-play')[0]; playButton.click();}, 2000)";

    return (
        <View style={{ flex: 1 }}>
            <WebView
                javaScriptEnabled={true}
                injectedJavaScript={jsCode}
                source={{ uri: 'https://duckduckgo.com/?q=google&ia=web' }}
            />
        </View>
    )
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can pass a javascript code into the WebView component to achieve that.

First, you need to wait some seconds for loading the web view, then get the play button element by its id/className or any query selector you want.

since your play button has a jp-play className, you can use it to select this play button and then click on it:

let's implement:

const jsCode = "setTimeout(function() { const playButton = document.getElementsByClassName('jp-play')[0]; playButton.click();}, 2000)";


<WebViw 
  source={{ uri: 'https://mmufmkenya.radio12345.com/' }}
  javaScriptEnabled={true}    // ---> don't forget this
  injectedJavaScript={jsCode}
/>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda