Skip to content

Instantly share code, notes, and snippets.

@troscoe
Last active December 16, 2015 00:49
Show Gist options
  • Save troscoe/5350466 to your computer and use it in GitHub Desktop.
Save troscoe/5350466 to your computer and use it in GitHub Desktop.
define(["Ti/_/Evented", "Ti/_/lang"], function(Evented, lang) {
return lang.setObject("Ti.Media", Evented, {
constants: {
UNKNOWN_ERROR: 0,
DEVICE_BUSY: 1,
NO_CAMERA: 2,
NO_VIDEO: 3,
VIDEO_CONTROL_DEFAULT: 1,
VIDEO_CONTROL_EMBEDDED: 1,
VIDEO_CONTROL_FULLSCREEN: 2,
VIDEO_CONTROL_NONE: 0,
VIDEO_CONTROL_HIDDEN: 0,
VIDEO_SCALING_NONE: 0,
VIDEO_SCALING_ASPECT_FILL: 2,
VIDEO_SCALING_ASPECT_FIT: 1,
VIDEO_SCALING_MODE_FILL: 3,
VIDEO_PLAYBACK_STATE_STOPPED: 0,
VIDEO_PLAYBACK_STATE_PLAYING: 1,
VIDEO_PLAYBACK_STATE_PAUSED: 2,
VIDEO_LOAD_STATE_PLAYABLE: 1,
VIDEO_LOAD_STATE_PLAYTHROUGH_OK: 2,
VIDEO_LOAD_STATE_STALLED: 4,
VIDEO_LOAD_STATE_UNKNOWN: 0,
VIDEO_REPEAT_MODE_NONE: 0,
VIDEO_REPEAT_MODE_ONE: 1,
VIDEO_FINISH_REASON_PLAYBACK_ENDED: 0,
VIDEO_FINISH_REASON_PLAYBACK_ERROR: 1,
VIDEO_FINISH_REASON_USER_EXITED: 2,
MEDIA_TYPE_PHOTO: "public.image",
MEDIA_TYPE_VIDEO: "public.video"
},
//beep: function() {},
//createAudioPlayer: function() {},
createSound: function(args) {
return new air.Sound(new air.URLRequest(args['url']));
},
createVideoPlayer: function(args) {
return new (require("Ti/Media/VideoPlayer"))(args);
},
vibrate: function(pattern) {
"vibrate" in navigator && navigator.vibrate(require.is(pattern, "Array") ? pattern : [pattern | 0]);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment