Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
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 answers
Answer question

0

the doc says create Returns: MediaObject not a promise

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!