Skip to content

Commit

Permalink
Merge pull request #74 from vishalduggal/timob-11884-30X
Browse files Browse the repository at this point in the history
[TIMOB-11884] Set correct max value
  • Loading branch information
srahim committed Nov 28, 2012
2 parents fd5d28c + 113cc38 commit b5c5450
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
8 changes: 7 additions & 1 deletion Resources/ui/common/phone/sound_file.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function sound_file() {
var win = Titanium.UI.createWindow();

var timob7502fix = ((Ti.version >= '3.0.0') && (Titanium.Platform.name == 'iPhone OS'));
var file = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'etc/cricket.wav');

// load from file object
Expand All @@ -19,7 +20,12 @@ function sound_file() {
play.addEventListener('click', function()
{
sound.play();
pb.max = sound.duration;
if (timob7502fix) {
pb.max = sound.duration*1000;
}
else {
pb.max = sound.duration;
}
});
win.add(play);

Expand Down
8 changes: 7 additions & 1 deletion Resources/ui/common/phone/sound_file_url.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function sound_file_url() {
var win = Titanium.UI.createWindow();

var timob7502fix = ((Ti.version >= '3.0.0') && (Titanium.Platform.name == 'iPhone OS'));
var file = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'etc/cricket.wav');
var file2 = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory,'etc/pop.caf');

Expand All @@ -20,7 +21,12 @@ function sound_file_url() {
play.addEventListener('click', function()
{
sound.play();
pb.max = sound.duration;
if (timob7502fix) {
pb.max = sound.duration*1000;
}
else {
pb.max = sound.duration;
}
});
win.add(play);

Expand Down
10 changes: 9 additions & 1 deletion Resources/ui/common/phone/sound_local.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ function sound_local() {

var win = Titanium.UI.createWindow();

//TIMOB-7502. TIme moved to ms but duration is still reported in seconds
var timob7502fix = ((Ti.version >= '3.0.0') && (Titanium.Platform.name == 'iPhone OS'));

//TODO: USE OBJECT
var sound = Titanium.Media.createSound();
sound.url='/etc/cricket.wav'; // For testing #1913
Expand All @@ -22,7 +25,12 @@ function sound_local() {
play.addEventListener('click', function()
{
sound.play();
pb.max = sound.duration;
if (timob7502fix) {
pb.max = sound.duration*1000;
}
else {
pb.max = sound.duration;
}
});
win.add(play);

Expand Down
10 changes: 9 additions & 1 deletion Resources/ui/common/phone/sound_remote_url.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
function sound_remote_url() {
var win = Titanium.UI.createWindow();
var isIOS = Titanium.Platform.name == 'iPhone OS';

//TIMOB-7502. TIme moved to ms but duration is still reported in seconds
var timob7502fix = ((Ti.version >= '3.0.0') && (Titanium.Platform.name == 'iPhone OS'));

var url = "http://www.archive.org/download/CelebrationWav/1.wav";

Expand Down Expand Up @@ -37,7 +40,12 @@ function sound_remote_url() {
play.addEventListener('click', function()
{
sound.play();
pb.max = sound.duration;
if (timob7502fix) {
pb.max = sound.duration*1000;
}
else {
pb.max = sound.duration;
}
});
win.add(play);

Expand Down

0 comments on commit b5c5450

Please sign in to comment.