[TIMOB-25732] Titanium.Video constants, VIDEO_PLABACK_STATE_PLAYING etc don't work
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2018-01-29T19:54:39.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | ILAY SENER |
Assignee | Unknown |
Created | 2018-01-28T10:49:46.000+0000 |
Updated | 2018-08-06T17:41:12.000+0000 |
Description
trying to get the status of the video playback but the constants are all undefined, hence my logic is not working...
to reproduce:
1)
var activeAd = Titanium.Media.createVideoPlayer({
url :"select a video file",
backgroundColor : '#fffae8',
scalingMode : Titanium.Media.VIDEO_SCALING_MODE_FILL,
showsControls : false,
autoplay : true
});
2) add below event listeners
activeAd.addEventListener("complete", adWatchCalculate);
activeAd.addEventListener("error", adWatchCalculate);
// activeAd.addEventListener("playbackstate", adWatchCalculate);
activeAd.addEventListener("playbackstate", function(e) {
console.log('e.playbackState ' + e.playbackState);
console.log('Titanium.Media.VIDEO_PLAYBACK_STATE_PLAYING ' + Titanium.Media.VIDEO_PLAYBACK_STATE_PLAYING);
console.log('Titanium.Media.VIDEO_PLAYBACK_STATE_INTERRUPTED ' + Titanium.Media.VIDEO_PLAYBACK_STATE_INTERRUPTED);
console.log('Titanium.Media.VIDEO_PLAYBACK_STATE_PAUSED ' + Titanium.Media.VIDEO_PLAYBACK_STATE_PAUSED);
console.log('Titanium.Media.VIDEO_PLAYBACK_STATE_STOPPED ' + Titanium.Media.VIDEO_PLAYBACK_STATE_STOPPED);
if (e.playbackState == Titanium.Media.VIDEO_PLAYBACK_STATE_PLAYING) {
adLoadSuccess = true;
console.log('true');
}
});
OUTCOME IS as below:
[INFO] : e.playbackState 0
[INFO] : Titanium.Media.VIDEO_PLAYBACK_STATE_PLAYING undefined
[INFO] : Titanium.Media.VIDEO_PLAYBACK_STATE_INTERRUPTED undefined
[INFO] : Titanium.Media.VIDEO_PLAYBACK_STATE_PAUSED undefined
[INFO] : Titanium.Media.VIDEO_PLAYBACK_STATE_STOPPED undefined
I am trying to figure out if the video has started to play, but unable to...
Hey Ilay, hope you're doing good :-) Fixed as part of 7.0.2 (TIMOB-25640), try it out!
Thanks Hans. All is well, and hot here. How about yourself? Cheers, found a way around but will test 7.0.2.
Hi Hans, Issue seems to continue for 2 of the constants, seeking forward and backward. Please see below. [INFO] : Titanium.Media.VIDEO_PLAYBACK_STATE_INTERRUPTED 3 [INFO] : Titanium.Media.VIDEO_PLAYBACK_STATE_PAUSED 2 [INFO] : Titanium.Media.VIDEO_PLAYBACK_STATE_PLAYING 1 [INFO] : Titanium.Media.VIDEO_PLAYBACK_STATE_SEEKING_BACKWARD undefined [INFO] : Titanium.Media.VIDEO_PLAYBACK_STATE_SEEKING_FORWARD undefined [INFO] : Titanium.Media.VIDEO_PLAYBACK_STATE_STOPPED 0
2 of the constants are not fixed. please see the update. SDK 7.0.2.
[~isener] They have been removed in 7 as Apple does not currently offer them in their new APIs that we use since 7. The one we used before was deprecated a few years ago and should not be used anymore. This is also documented [here](https://github.com/appcelerator/titanium_mobile/pull/9715/files#diff-1041307683116a293d655456d80bb543R1364).
Thanks Hans. That I didn't know. I guess updated documentation is to come.
Closing as a duplicate. If this is in error, please reopen.