eclipsesource / eclipsesource/tabris-js
cordova media plugin not work on android!
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Description
### Problem description
I tried to play media on android using the cordova media plugin,
But it doesn't work (ios works). I have tried many times, but I can't solve it. Is there anyone who can help me?
### Expected behavior
With the official [example](https://github.com/eclipsesource/tabris-js/blob/v2.7.0/examples/cordova/MediaPage.js), extract part of the code, ios work, android has not been successful
### Environment
- Tabris.js version: 2.7
- Device: sharp
- OS: android 8.0
### Code snippet
```
const { Page,Button,app,ImageView,ui,WebView,contentView,Composite,ScrollView,Canvas,device,Popover,TextView,StatusBar} = require('tabris');
document.addEventListener("deviceready", onDeviceReady, true);
function onDeviceReady() {
console.log(Media);
}
var path1 = tabris.app.getResourceLocation("src/assets/media/media.wav");
var path2 =tabris.app.getResourceLocation("android_asset/www/media/media.wav");
function playAudio(url) {
var my_media = new Media(url,
// success callback
function () {
console.log("playAudio():Audio Success");
},
// error callback
function (err) {
console.log(JSON.stringify(err))
console.log("playAudio():Audio Error: " + err);
}
);
// Play audio
my_media.play();
my_media.setVolume('1.0');
}
new Button({
left: 10, top: 10,
text: 'Button'
}).on('select', ()=>playAudio(path1))
.appendTo(ui.contentView);
new Button({
left: 10, top: 10,
text: 'Button'
}).on('select', ()=>playAudio(path2))
.appendTo(ui.contentView);
```
Contributor guide
Assessment
This issue has not been assessed yet.