Quantcast
Viewing all articles
Browse latest Browse all 8068

Background Audio On Android

Hi All

I have a multi platform audio app using titaniums video player background audio works great on ios, but on android i cant seem to find anyway to get background audio to work as soon as i click the home button audio stops straight away any suggestions is this even possible?

Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({
    title : 'Test',
    backgroundColor : '#fff',
    exitOnClose : true
});
 
// Change to a valid URL
var contentURL = "http://www.example.com/stream.mp4";
 
var openButton = Ti.UI.createButton({
    title : "Start Video",
    top : "0dp",
    height : "40dp",
    left : "10dp",
    right : "10dp"
});
 
openButton.addEventListener('click', function() {
    var activeMovie = Titanium.Media.createVideoPlayer({
        url : contentURL,
        backgroundColor : 'blue',
        movieControlMode : Titanium.Media.VIDEO_CONTROL_DEFAULT,
        scalingMode : Titanium.Media.VIDEO_SCALING_ASPECT_FILL,
        fullscreen : true,
        autoplay : true
    });
 
    var closeButton = Ti.UI.createButton({
        title : "Exit Video",
        top : "0dp",
        height : "40dp",
        left : "10dp",
        right : "10dp"
    });
 
    closeButton.addEventListener('click', function() {
        activeMovie.hide();
        activeMovie.release();
        activeMovie = null;
    });
 
    activeMovie.add(closeButton);
});
win.add(openButton);
win.open();
Thanks

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>