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

223
Vistas
Property 'then' does not exist on type 'MediaObject'

I'm attempting to create a simple media player with Ionic 3 and the MediaObject from Ionic-Native is giving me some trouble.

app.component.ts

    import { Component } from '@angular/core';
    import { Platform } from 'ionic-angular';
    import { StatusBar } from '@ionic-native/status-bar';
    import { SplashScreen } from '@ionic-native/splash-screen';
    import { MediaPlugin, MediaObject } from '@ionic-native/media';

    import { HomePage } from '../pages/home/home';
    @Component({
      templateUrl: 'app.html'
    })
    export class MyApp {
      rootPage:any = HomePage;
      file:MediaObject = undefined;

      constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private media: MediaPlugin) {

        const onStatusUpdate = (status) => console.log(status);

        media.create('./path/to/file.mp3', onStatusUpdate)
          .then((file: MediaObject) => {``
            this.file = file;
        });
      }

      play() {
        this.file.play();
      }
    }

My issue is that when I serve the project I get "Property 'then' does not exist on type 'MediaObject'"

From my understanding media.create SHOULD be returning a MediaObject promise that once resolved will allow me to use the MediaObject.

Any insight is appreciated.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

the doc says create Returns: MediaObject not a promise

over 4 years ago · Santiago Trujillo 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