hi all
ok ! with ionic-native, i can play an audio file. I just want to display a message “playing” when the file is playing, then remove it at the end of the file. That s pretty simple. What i can’t handle is to capture the event of the end of the file. Is it possible ? I mean, i just want to remove the message “playing” when the player reach the end of the audio file .
So how can i do this one ?
I read doc, and have done exactly what is written, but onStatusUpdate fire the event 1 after f.play() and then nothing at all … Except when i stop the player with f.stop() , then i receive status 2 ( running ??? ) and 4 stopped. What am i doing wrong ? Please help me i can t find any solution. i saw that the plugin has been update la august and i have the last release. Here is my code and my json file below.
By the way, does the event “stopped” mean “has been stop by an action” or “media has reached the end of file”, or something else ? Thanks in advance
here s an extract of my typescript component
import { Media, MediaObject } from '@ionic-native/media';
....
const f:MediaObject = this.media.create(path);
f.onStatusUpdate.subscribe(status =>
{
this.message=this.message+" > onStatusUpdate="+status;
});
f.onSuccess.subscribe(() =>
{
this.message=this.message+" > onSuccess"+status;
});
f.onError.subscribe(error =>
{
this.message=this.message+" > onError"+error;
});
f.play();
and here is my configuration
{
"name": "myApp_a",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.1.3",
"@angular/compiler": "4.1.3",
"@angular/compiler-cli": "4.1.3",
"@angular/core": "4.1.3",
"@angular/forms": "4.1.3",
"@angular/http": "4.1.3",
"@angular/platform-browser": "4.1.3",
"@angular/platform-browser-dynamic": "4.1.3",
"@ionic-native/android-permissions": "^4.2.1",
"@ionic-native/app-preferences": "^4.2.1",
"@ionic-native/core": "3.12.1",
"@ionic-native/file": "^4.2.1",
"@ionic-native/media": "^4.2.1",
"@ionic-native/native-page-transitions": "^4.2.1",
"@ionic-native/screen-orientation": "^4.3.0",
"@ionic-native/splash-screen": "3.12.1",
"@ionic-native/status-bar": "3.12.1",
"@ionic/storage": "2.0.1",
"com.telerik.plugins.nativepagetransitions": "^0.6.5",
"cordova": "^7.0.1",
"cordova-android": "^6.2.3",
"cordova-plugin-android-permissions": "^1.0.0",
"cordova-plugin-app-preferences": "^0.99.3",
"cordova-plugin-compat": "^1.1.0",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-file": "^4.3.3",
"cordova-plugin-filepath": "^1.0.2",
"cordova-plugin-media": "^3.0.1",
"cordova-plugin-screen-orientation": "^2.0.1",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
"es6-promise-plugin": "git+https://github.com/vstirbu/PromisesPlugin.git",
"ionic-angular": "3.6.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"rxjs": "5.4.0",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.12"
},
"devDependencies": {
"@ionic/app-scripts": "2.1.3",
"typescript": "2.3.4"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-media": {},
"cordova-plugin-file": {},
"cordova-plugin-android-permissions": {},
"cordova-plugin-filepath": {},
"com.telerik.plugins.nativepagetransitions": {},
"cordova-plugin-app-preferences": {},
"cordova-plugin-screen-orientation": {}
},
"platforms": [
"android"
]
}
}