tabris-js icon indicating copy to clipboard operation
tabris-js copied to clipboard

cordova media plugin not work on android!

Open Nexter-day opened this issue 5 years ago • 5 comments

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, 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);

Nexter-day avatar Jul 31 '19 07:07 Nexter-day

Unfortunatly we can not provide support for third party plugins. In case of media playback we have will provide audio support via https://github.com/eclipsesource/tabris-js/issues/1888.

mpost avatar Aug 01 '19 08:08 mpost

Video widgets is an easy way,but how can I set the video volume? It doesn't seem to have this option

Nexter-day avatar Aug 09 '19 09:08 Nexter-day

that is correct. you could open an issue for a feature request.

mpost avatar Aug 09 '19 09:08 mpost

@Nexter-day There's also cordova-plugin-android-volume and cordova-plugin-volume-control. Note that the latter can be used on iOS, but Apple will reject submissions to the App Store.

cookieguru avatar Aug 10 '19 08:08 cookieguru

Maybe one of the solutions would be to see why the media plugin that worked well on the old versions of TabrisJs doesn't work at all on the new versions

ishigo1987 avatar May 27 '20 19:05 ishigo1987