Send a MMAPI_EVENT native event when the screenshot is taken and return its data back to DirectPlayer. Fixes #358

This commit is contained in:
Marco Castelluccio 2014-11-25 17:06:09 +01:00
Родитель 79332d5314
Коммит 2bbad5a17a
2 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -80,6 +80,8 @@ Media.contentTypeToFormat = new Map([
Media.supportedAudioFormats = ["MPEG_layer_3", "wav", "amr", "ogg"];
Media.supportedImageFormats = ["JPEG", "PNG"];
Media.EVENT_MEDIA_SNAPSHOT_FINISHED = 11;
Native.create("com/sun/mmedia/DefaultConfiguration.nListContentTypesOpen.(Ljava/lang/String;)I", function(jProtocol) {
var protocol = util.fromJavaString(jProtocol);
var types = [];
@ -427,6 +429,14 @@ ImageRecorder.prototype.recipient = function(message) {
case "snapshot":
this.snapshotData = new Int8Array(message.data);
MIDP.sendNativeEvent({
type: MIDP.MMAPI_EVENT,
intParam1: this.playerContainer.handle,
intParam2: 0,
intParam3: 0,
intParam4: Media.EVENT_MEDIA_SNAPSHOT_FINISHED,
}, MIDP.foregroundIsolateId);
break;
}
}
@ -466,6 +476,10 @@ ImageRecorder.prototype.startSnapshot = function(imageType) {
this.sender({ type: "snapshot", imageType: imageType });
}
ImageRecorder.prototype.getSnapshotData = function(imageType) {
return this.snapshotData;
}
function PlayerContainer(url) {
this.url = url;
@ -681,6 +695,10 @@ PlayerContainer.prototype.startSnapshot = function(imageType) {
this.player.startSnapshot(imageType);
}
PlayerContainer.prototype.getSnapshotData = function() {
return this.player.getSnapshotData();
}
var AudioRecorder = function(aMimeType) {
this.mimeType = aMimeType || "audio/ogg";
this.eventListeners = {};
@ -1107,3 +1125,7 @@ Native.create("com/sun/mmedia/NativeTonePlayer.nStopTone.(I)Z", function(appId)
Native.create("com/sun/mmedia/DirectPlayer.nStartSnapshot.(ILjava/lang/String;)V", function(handle, imageType) {
Media.PlayerCache[handle].startSnapshot(imageType);
});
Native.create("com/sun/mmedia/DirectPlayer.nGetSnapshotData.(I)[B", function(handle) {
return Media.PlayerCache[handle].getSnapshotData();
});

Просмотреть файл

@ -867,6 +867,7 @@ MIDP.RELEASED = 2;
MIDP.DRAGGED = 3;
MIDP.COMMAND_EVENT = 3;
MIDP.EVENT_QUEUE_SHUTDOWN = 31;
MIDP.MMAPI_EVENT = 45;
MIDP.GESTURE_EVENT = 71;
MIDP.GESTURE_TAP = 0x1;
MIDP.GESTURE_LONG_PRESS = 0x2;