تم النشر منذ 2 Jan 2014 السلام عليكم و رحمة الله و بركاتهتحية طيبة لكم احبتي الكرام، ارجو المساعدة للاهمية القصوى و لكم الاجر و الثواب ان شاء الله احتاج لشرح هذا الكود خطوة بخطوة مع الاسهاب بالشرح الكود هو : function VideoShift() { "use strict"; var self = Ti.UI.createView({navBarHidden:true}), myNum = 0, timer=null, click1=null, click2=null, videoPlayer, myButtonChoice1a, myButtonChoice1b, image; function setupNowButtonsChoice1() { function removeButtons() { Ti.API.info('remove two buttons: '); myButtonChoice1a.removeEventListener('click', click1Function); myButtonChoice1a.hide(); myButtonChoice1a = null; myButtonChoice1b.removeEventListener('click', click2Function); myButtonChoice1b.hide(); myButtonChoice1b = null; } myButtonChoice1a = Ti.UI.createButton({ title: 'Kvinden', color: 'faec06' , font: { fontSize:24 }, top: 200, width: 400, height: 100 }); function click1Function(e){ videoPlayer.setCurrentPlaybackTime(33000.50000); videoPlayer.play(); removeButtons(); } function click2Function(e){ videoPlayer.setCurrentPlaybackTime(16500.33000); videoPlayer.play(); removeButtons(); } click1 = myButtonChoice1a.addEventListener('click',click1Function); myButtonChoice1b = Ti.UI.createButton({ title: 'Manden', color: 'faec06' , font: { fontSize:24 }, top: 250, width: 400, height: 100 }); click2 = myButtonChoice1b.addEventListener('click',click2Function); self.add(myButtonChoice1a); self.add(myButtonChoice1b); } image = Ti.UI.createImageView({ image:'myimage1.png', top : 70, width: 100, height : 50 }); self.add(image); videoPlayer = Titanium.Media.createVideoPlayer({ top : 50, autoplay : false, backgroundColor : 'transparent', height : 300, width : 300, mediaControlStyle : Titanium.Media.VIDEO_CONTROL_DEFAULT, scalingMode : Titanium.Media.VIDEO_SCALING_ASPECT_FIT }); function loadChoice1() { Ti.API.info("now setup buttons"); setupNowButtonsChoice1(); } function setupChoice1(inParam) { switch (inParam.choice) { case 'choice1' : loadChoice1(); break; default : break; } } function doTiming() { Ti.API.info('timer is running: '); Ti.API.info('Time: '+videoPlayer.currentPlaybackTime); var time1 = videoPlayer.currentPlaybackTime; if ((time1 > 15000) && (time1 < 15700) ) { clearInterval(timer); videoPlayer.pause(); Ti.App.fireEvent('VideoChoice1', {choice: 'choice1'}); } if (time1 >= videoPlayer.duration){ clearInterval(timer); } } videoPlayer.addEventListener('playbackState', function(e) { Ti.API.info('state is changing'); if (myNum===0){ myNum=1; timer = setInterval(doTiming,250); Ti.API.info("Video starting: "+e); }else { Ti.API.info("Video stopping: "+e); myNum = 0; clearInterval(timer); } }); videoPlayer.url = 'localhost/samlet.mp4'; self.add(videoPlayer); Ti.App.addEventListener('VideoChoice1', setupChoice1); return self;}module.exports = VideoShift; 0 شارك هذا الرد رابط المشاركة شارك الرد من خلال المواقع ادناه
0 قام بالرد منذ 7 Jun 2014 يظهر ان الكود يقوم بتشغيل ملف فيديو وعند وقت معين يقوم بوقف الفيديو وعمل اكشن معين هذا الرابط يوضح كل شئ اخي العزيز http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.Media.VideoPlayer 0 شارك هذا الرد رابط المشاركة شارك الرد من خلال المواقع ادناه
تم النشر منذ
السلام عليكم و رحمة الله و بركاته
تحية طيبة لكم احبتي الكرام، ارجو المساعدة للاهمية القصوى و لكم الاجر و الثواب ان شاء الله
احتاج لشرح هذا الكود خطوة بخطوة مع الاسهاب بالشرح
الكود هو :
شارك هذا الرد
رابط المشاركة
شارك الرد من خلال المواقع ادناه