Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

VideoPlayer not working for Android

$
0
0

Hi Everyone,

I've been working with Titanium lately, and I just noticed that I'm unable to play a video through Titanium on Android. It does however, work for iOS.

videooverlay.xml:

<Alloy>
        <Window class="container" title="Video Player" backButtonTitle="Videos" onOpen="onOpen">
           <VideoPlayer id="videoPlayer" url="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" fullscreen="true" autoplay="false" />
        </Window>
    </Alloy>
videooverlay.js:
var args = arguments[0] || {};
 
    function onOpen(e) {
        if (OS_ANDROID) {
            console.log("TEST");
            $.videoPlayer.addEventListener("preload", onPreloadReady);
        } else {
            $.videoPlayer.play();
        }
    }
 
    $.videoPlayer.addEventListener('complete', function(e) {
        if (e.reason == 0) {
            $.videooverlay.close({
                animate : true
            });
        };
    });
 
    $.videoPlayer.addEventListener('fullscreen', function(e) {
        if (e.entering == 0) {
            $.videooverlay.close({
                animate : true
            });
        };
    });
 
    function onPreloadReady(e) {
        console.log("Ready to play! :)");
        //"this" is $.video, "e.type" is the name of this event
        this.removeEventListener(e.type, onPreloadReady);
        this.play();
    }
When investigating the output window I noticed these lines:
[DEBUG] :  Module: Loading module: alloy/controllers/videooverlay/videooverlay -> Resources/alloy/controllers/videooverlay/videooverlay.js
    [WARN] :   EGL_emulation: eglSurfaceAttrib not implemented
    [WARN] :   OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa253db20, error=EGL_SUCCESS
    [DEBUG] :  MediaPlayer: Couldn't open file on client side, trying server side
    [DEBUG] :  Window: Checkpoint: postWindowCreated()
    [INFO] :   TEST
    [ERROR] : [SOME VIDEOPLAYER ERROR I FORGOT TO WRITE DOWN BUT HAS -2147483648 IN IT]
    [ERROR] : [SOME VIDEOPLAYER ERROR I FORGOT TO WRITE DOWN BUT HAS -2147483648 IN IT]
    [ERROR] : TiVideoView8: (main) [30339,49762] Error: 1,-2147483648
It appears that it does work on my handheld (Samsung Galaxy S4), but not on the emulator (Google Nexus 9).

However, I noticed that it did not show the video in fullscreen mode, even though it has been explicitly told to do so.

function playVideo(e) {
        var videoOverlay = Alloy.createController("videooverlay/videooverlay").getView();
        videoOverlay.open({ fullscreen: true });
    }
I'm hoping someone could enlighten me on this issue.

Kind Regards, Larssy1


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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