Problem
"VIDEO_REPEAT_MORE_ONE" (herewithin "ONE") repeats the video forever. The docs state, "the video will repeat once", so something is not quite right.
Solution
Add a third constant, "VIDEO_REPEAT_MODE_INFINITE", and bind that to the existing behavior of "ONE". Then fix "ONE" so that it will repeat just once.
Sample Code
The following code will repeat forever if the bug is present. Drop it in an app.js, and it will download the mp4 before it plays it.
var win = Ti.UI.createWindow({ backgroundColor: '#000' });
var url = 'http://theatercrew.com/sample.mp4';
var file = Ti.Filesystem.getFile('file:///sdcard/').exists()
? Ti.Filesystem.getFile('file:///sdcard/sample.mp4')
: Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'sample.mp4');
function playVideo() {
var video = Ti.Media.createVideoPlayer({
url: file.nativePath,
repeatMode: Ti.Media.VIDEO_REPEAT_MODE_ONE
});
if (parseFloat(Ti.Platform.version) >= 3.2) {
win.add(video);
}
video.play();
}
function downloadVideo() {
var progress = Ti.UI.createProgressBar({ max: 1, min: 0, value: 0, visible: true });
win.add(progress);
var client = Ti.Network.createHTTPClient({
ondatastream: function(e) {
progress.value = e.progress;
},
onload: function() {
file.write(this.responseData);
win.remove(progress);
playVideo();
}
});
client.open('GET', url);
client.send();
}
if (file.exists()) {
playVideo();
}
else {
downloadVideo();
}
win.open();
Associated Helpdesk Ticket
http://appc.me/c/APP-667723
This is a documentation bug, not a code bug. The documentation for the video SHOULD BE: "constant for repeating one video setting", akin to MUSIC_PLAYER_REPEAT_ONE. That is, the 'one' indicates number of items to repeat nonstop, not number of times to repeat it.
As of this posting, the documentation correctly notes: {quote} name: VIDEO_REPEAT_MODE_ONE summary: Constant for repeating one video (i.e., the one video will repeat constantly) during playback. {quote} Closing this bug as invalid.
Closing ticket as invalid with reference to the above comments.