Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18858] Android: Videoplayer events do not work well on Android lollipop

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid-5, videoplayer
ReporterWilliam Hetherington
AssigneeUnknown
Created2015-04-24T19:45:04.000+0000
Updated2018-02-28T19:55:31.000+0000

Description

The 'complete' event does not seem to fire from the VideoPlayer closes, nor does the click handler for the "Exit Video" button I added fire when I hit "Exit Video", but the VideoPlayer does close. Using the "back" button on the device itself to close the video player does not cause 'complete' to fire either. I have some code similar to the following:
function openPlayer(e) {
  var videoPlayer = Ti.Media.createVideoPlayer({
    url: "/demo.mp4",
    mediaControlStyle: Titanium.Media.VIDEO_CONTROL_FULLSCREEN,
    scalingMode: Ti.Media.VIDEO_SCALING_ASPECT_FIT,
    fullscreen: true,
    autoplay: true
  });
 
  var closeButton = Ti.UI.createButton({
    title: "Exit Video",
    top: "0dp",
    height: "40dp",
    left: "10dp",
    right: "10dp"
  });
 
  closeButton.addEventListener('click', function() {
    videoPlayer.hide();
    videoPlayer.release();
    videoPlayer = null;
  });
 
  videoPlayer.add(closeButton);
 
  videoPlayer.addEventListener('load', function(player) {
    console.log("loaded");
  });
 
  videoPlayer.addEventListener('keypressed', function(e) {
    console.log("keypressed");
  });
  videoPlayer.addEventListener('complete', function(player) {
    console.log("DONE");
  });
  videoPlayer.addEventListener('playing', function(player) {
    console.log("playing");
  });
  videoPlayer.addEventListener('error', function(player) {
    console.log("error");
  });
}
 
function onClick(e) {
  openPlayer(null);
}
$.btn_open.addEventListener("click", onClick);
$.index.open();

Comments

  1. Michael Gangolf 2015-04-24

    Not working on a Nexus 4 (5.1) with 3.5.1 GA and 3.5.2.v20150313152423 According to this file: https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/media/src/java/ti/modules/titanium/media/VideoPlayerProxy.java#L714 it should fire if it was playing and the activity gets destroyed. But it doesn't seem to fire on android

JSON Source