hello I do not know how to add video from JS to XML
.js
var args = arguments[0] || {}; var miId2 = args.miId; // alert("idrow:" + miId2); var argsDetalle = {}; var pista;
function atras() { $.vistaDetalle.close(); }
var momiasC = Alloy.Collections.momiasCollection;
var lg = Ti.Locale.currentLanguage.indexOf("es"); //length
momiasC.fetch({ query : "SELECT * FROM momias WHERE qrcode='" + miId2 + "'" }); Ti.API.info("length" + momiasC.length); var nol = momiasC.length; if (nol > 0) { momiasC.forEach(function(e) { Ti.API.info("LG" + Ti.Platform.locale); Ti.API.info("celda" + JSON.stringify(e)); Ti.API.info("loqueda " + lg);
$.title.text = e.get("nombre");
$.imagen.image = "/imagesMomias/" + e.get("foto");
if (lg >= 0) {
$.descripcion.text = e.get("despicion");
setPlayer("/audios/" + e.get("idaudioespañol") + ".mp4");
} else {
$.descripcion.text = e.get("ingles");
setPlayer("/audios/" + e.get("idaudioingles") + ".mp4");
}
});
$.vistaDetalle.open({
transition : Titanium.UI.iPhone.AnimationStyle.NONE
});
} else {
alert("no existe");
}
function setPlayer(pista) {
var videoPlayer = Titanium.Media.createVideoPlayer({
url : pista,
// title : descripcion,
autoplay : true,
// backgroundColor : 'black',
height : 300,
width : 300,
// fullscreen : true,
mediaControlStyle : Titanium.Media.VIDEO_CONTROL_DEFAULT,
// scalingMode : Titanium.Media.VIDEO_SCALING_ASPECT_FIT
});
}
XML
<Alloy>
<Window id="vistaDetalle" backgroundColor="white">
<View id="header" backgroundColor="#61370e">
<!-- <Button backgroundImage="/images/atras2.png" height="75%" top="22%" onClick="atras" width="11%" left="0"></Button> -->
<Label id="title" color="white">Titulo</Label>
</View>
<!-- <View id="scroll" backgroundImage="/images/fondovistadetalle.jpg"> -->
<View id="scroll">
<ImageView id="imagen"></ImageView>
<ScrollView id="scrollDesc">
<Label id="descripcion"></Label>
</ScrollView>
¿¿¿ <VideoPlayer id="videoPlayer" ns="Ti.Media" top="2" url="/atmovie.mp4"
height="300" width="300" backgroundColor="blue" autoplay="true" />???
</View>
</Window>
</Alloy>