Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

104
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda