Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 30    Views: 116

satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
04/29/13 05:51 AM (11 years ago)

AT53 Video Player

After select video or music i want it to play at once. So, Does anyone know how to by pass AT53 Video Player's play button? Thank you in advance. Satit P.
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
04/29/13 06:01 AM (11 years ago)
Hi @satit, Not exactly sure what you mean with "bypass"? Contact the developer and he will be able to assist you. LA
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
04/29/13 06:10 AM (11 years ago)
Hi LA I think Satit means, is there any way for the video to play straight away when selected from a menu screen. Currently, you select the video from a menu screen, it then takes you to a page with a play button, which you then have to press to play video. Like me also, I would like to know if you can select the video from you r menu screen and it plays immediately as oppose to going to a landing page first. Did I make sense?
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
04/29/13 06:17 AM (11 years ago)
Hey @Dragon007, Yes makes total sense thank you! I didn't develop it so I don't want to step on any toes or make a recommendation that is incorrect. I would imagine you would have to change a piece of code then you may have to change another so it will stop when the App or that particular screen is completed. LA
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
04/29/13 06:31 AM (11 years ago)
lol! forgive me for laughing at your reply. Like Satit, I have no idea how to achieve the goal of bypassing the landing page.
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
04/29/13 06:41 AM (11 years ago)
lol @Dragon007! You lost me! LA
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
04/29/13 06:43 AM (11 years ago)
iOS? Android? Sounds like you're building a menu screen and linking each of those menu items to a AT53 video screen- Think about it like this - the rowtap is what launches the AT53 Video Plug-in screen to load. Similar to the new Youtube playlist plug-in, That displays the vids ins a table and the rowtap is what launches the screen. I've seen people tweek the iOS code and add [player prepareToPlay]; [player.view setFrame: myView.bounds]; [myView addSubview: player.view]; [player play]; How well it works I'm not really sure.....
 
satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
like
04/29/13 06:49 AM (11 years ago)
@Dragon007 thank for describe clearly want i need. i'd succeed to do with SP Youtube video plugin on Android. but for AT53 can not. @ATRAIN53 Could you please advice for android.? Satit P.
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
04/29/13 06:49 AM (11 years ago)
Thank you @ATRAIN53! LA
 
satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
like
04/29/13 06:53 AM (11 years ago)
For those of people who using SP Youtube Video Plugin and want to select menu then playing at once. it's can be done by editing a file Sp_android_youtube.java From the line no. 134-151 //add button to the screen to launch OpenYouTubePlayerActivity.... Button myButton = (Button) findViewById(R.id.play); myButton.setOnClickListener(new OnClickListener(){ public void onClick(View v){ //when button is clicked will parse url and launch video Intent nextIntent = new Intent(null, Uri.parse("ytv://"+ videoURL), Sp_youtube_android.this, OpenYouTubePlayerActivity.class); startActivity(nextIntent); } }); // end of insert button to launch OpenYouTubePlayer, continue BT flow Change TO: /* //add button to the screen to launch OpenYouTubePlayerActivity.... Button myButton = (Button) findViewById(R.id.play); myButton.setOnClickListener(new OnClickListener(){ public void onClick(View v){ */ //when button is clicked will parse url and launch video Intent nextIntent = new Intent(null, Uri.parse("ytv://"+ videoURL), Sp_youtube_android.this, OpenYouTubePlayerActivity.class); startActivity(nextIntent); finish(); ; // end of insert button to launch OpenYouTubePlayer, continue BT flow I did by @IAN's Advice Thank you @IAN again Satit P.
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
04/29/13 06:56 AM (11 years ago)
Awesome advice and suggestion @satit! LA
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
04/29/13 07:05 AM (11 years ago)
Sure, give me a few days to look into it and see if any code exists out there. You do understand that the menu row tap to launch a screen is big part of this equation? What you really want is an Android listview with PLAY buttons in the row that launch activities. The PLAY button in the AT code is attached to an onclick listener that launches the mediaplayer activity. The SP YT Player also requires a tap to launch the video. It needs a webview so it can first connect to YT and then buffer the video a bit. I've spent a few days building a similar screen for iOS audio. Making a menu row tap do 2 things is difficult. Code can't think for you, there has to be some user interaction....
 
satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
like
04/29/13 07:18 AM (11 years ago)
@ATRAIN53 Thank you i will look forward to your stuff. Basically, I know not much about code.I have a lot of menu to play many video and mp3 from my server.if our clients want to see or listen it by push a menu and then push play button again. it's may boring to the clients. Thank you again. Satit P.
 
Frogman
Aspiring developer
Profile
Posts: 264
Reg: Jan 05, 2013
Bratislava
11,190
like
04/29/13 09:25 AM (11 years ago)
Very nice that you provide the code, this is what I like in BT. Maybe in the future I will be also looking how to do this, then I know where to look it up. Good luck! Frogman
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
05/30/13 09:56 PM (10 years ago)
Hi Guys, In the AT53 player you could just call the play method sooner. All I did was add playVideo(); just before the comment //hide video player until play clicked. // playVideo method added here to override Button playVideo(); /* //hide the video player until play clicked... videoView.setVisibility(View.VISIBLE); //set onclick listener for play button... imagePlay.setOnClickListener(new OnClickListener(){ public void onClick(View v){ playVideo(); } }); */
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
05/30/13 09:59 PM (10 years ago)
Then in the stop video method just add finish(); to return to menu //stop video... public void stopVideo(){ BT_debugger.showIt(activityName + ":stopVideo"); // Added finish to return to menu when video finishes finish();
 
satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
like
05/31/13 01:19 AM (10 years ago)
@Ian Before modified the code , AT53 able to load and play video, mp3 fast. The code which your advice able to bypass play button. but video or mp3 can not play. After select AT53 menu there are show the word "Loading , Please be patient some video ....." long and long time. Here my code: .... //setup listeners for video view.. videoView.setOnCompletionListener(videoViewCompletionListener); videoView.setOnPreparedListener(videoViewPreparedListener); videoView.setOnErrorListener(videoViewErrorListener); playVideo(); //hide the video player until play clicked... videoView.setVisibility(View.GONE); .... //onStop @Override protected void onStop(){ super.onStop(); //BT_debugger.showIt(activityName + ":onStop"); finish(); }
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
05/31/13 08:03 AM (10 years ago)
Hi @satit, Here is what my AT53 code looks like now. Lots of stuff commented out cuz I don't need any images or descriptions. hope it helps https://dl.dropboxusercontent.com/u/39276137/AT53VideoBypassButton.txt
 
satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
like
05/31/13 08:55 AM (10 years ago)
Hi @Ian It's work!!! You are a genius man. After replace with your code it's able to bypass play button. my video and music can play at once that meet my requirement. There are something a little that it's still show a play image always during play media files. Thank you very much. BTW: i created a patch file as below , it's may be useful for others. *** DO NOT FORGET TO REPLACE THE PACKAGE NAME THE SAME AS YOURS. *** ================================================================== --- At53_video_player.java 2013-05-31 22:43:24.731921892 +0700 +++ At53_video_player-hack.java 2013-05-31 22:43:49.883922567 +0700 @@ -50,6 +50,7 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; +import android.view.WindowManager; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; @@ -84,11 +85,18 @@ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); + + + + this.activityName = "At53_video_player"; - BT_debugger.showIt(activityName + ":onCreate"); + BT_debugger.showIt(activityName + ":onCreate"); + + + setContentView(R.layout.screen_at53_video_player); //reference to base layout.. - LinearLayout baseView = (LinearLayout)findViewById(R.id.baseView); + // LinearLayout baseView = (LinearLayout)findViewById(R.id.baseView); //setup background colors... BT_viewUtilities.updateBackgroundColorsForScreen(this, this.screenData); @@ -98,27 +106,27 @@ backgroundImageWorkerThread = new BackgroundImageWorkerThread(); backgroundImageWorkerThread.start(); } - + /* //setup navigation bar... LinearLayout navBar = BT_viewUtilities.getNavBarForScreen(this, this.screenData); if(navBar != null){ baseView.addView(navBar); } - + */ //inflate this screens layout file... LayoutInflater vi = (LayoutInflater)thisActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View thisScreensView = vi.inflate(R.layout.screen_at53_video_player, null); //add the view to the base view... - baseView.addView(thisScreensView); + // baseView.addView(thisScreensView); //load up values from JSON... - videoImageFileName = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "videoImageFileName", ""); + // videoImageFileName = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "videoImageFileName", ""); videoFileName = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "videoFileName", ""); videoURL = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "videoURL", ""); - videoDescription = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "videoDescription", ""); - videoDescriptionColor = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "videoDescriptionColor", "#CCCCCC"); - + // videoDescription = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "videoDescription", ""); + // videoDescriptionColor = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "videoDescriptionColor", "#CCCCCC"); +/* //movie finished load screen... videoEndedLoadScreenItemId = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "videoEndedLoadScreenItemId", ""); videoEndedLoadScreenNickname = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "videoEndedLoadScreenNickname", ""); @@ -140,35 +148,42 @@ //ignore... } } - + */ //get reference to layout parts... - imageVideo = (ImageView) baseView.findViewById(R.id.imageVideo); - imagePlay = (ImageView) baseView.findViewById(R.id.imagePlay); - textDescription = (TextView) baseView.findViewById(R.id.textDescription); - videoView = (VideoView) baseView.findViewById(R.id.videoView); + // imageVideo = (ImageView) baseView.findViewById(R.id.imageVideo); + // imagePlay = (ImageView) baseView.findViewById(R.id.imagePlay); + // textDescription = (TextView) baseView.findViewById(R.id.textDescription); + videoView = (VideoView)findViewById(R.id.videoView); //setup listeners for video view.. videoView.setOnCompletionListener(videoViewCompletionListener); videoView.setOnPreparedListener(videoViewPreparedListener); videoView.setOnErrorListener(videoViewErrorListener); - + + // playVideo here to override Button + playVideo(); + /* //hide the video player until play clicked... - videoView.setVisibility(View.GONE); + videoView.setVisibility(View.VISIBLE); + + //set onclick listener for play button... imagePlay.setOnClickListener(new OnClickListener(){ public void onClick(View v){ playVideo(); + } }); + */ //set video text... - textDescription.setText(videoDescription); + // textDescription.setText(videoDescription); //set video text color... - textDescription.setTextColor(BT_color.getColorFromHexString(videoDescriptionColor)); - + // textDescription.setTextColor(BT_color.getColorFromHexString(videoDescriptionColor)); +/* //set video image.... if(BT_fileManager.getResourceIdFromBundle("drawable", videoImageFileName) > 0){ Drawable d = BT_fileManager.getDrawableByName(videoImageFileName); @@ -178,7 +193,7 @@ //flag as created.. didCreate = true; - + */ }//onCreate //onStart @@ -233,13 +248,13 @@ showProgress("Loading...", "Please be patient, some videos take a moment to begin playing"); //hide the play button... - imagePlay.setVisibility(View.GONE); + // imagePlay.setVisibility(View.GONE); //hide the video image... - imageVideo.setVisibility(View.GONE); + // imageVideo.setVisibility(View.GONE); //hide the description... - textDescription.setVisibility(View.GONE); + // textDescription.setVisibility(View.GONE); //show the video player... videoView.setVisibility(VISIBLE); @@ -323,18 +338,19 @@ //stop video... public void stopVideo(){ BT_debugger.showIt(activityName + ":stopVideo"); - + // Added finish to return to menu when video finishes + finish(); //hide the video player... - videoView.setVisibility(View.GONE); + //videoView.setVisibility(View.GONE); //show the description... - textDescription.setVisibility(VISIBLE); + // textDescription.setVisibility(VISIBLE); //show the video image... - imageVideo.setVisibility(VISIBLE); + // imageVideo.setVisibility(VISIBLE); //show the play button... - imagePlay.setVisibility(VISIBLE); + // imagePlay.setVisibility(VISIBLE); } @@ -346,7 +362,7 @@ //hide the videoView, show controls again... stopVideo(); - + //transition to another screen? BT_item nextScreenLoadObject = null; if(videoEndedLoadScreenItemId.length() > 1 && !videoEndedLoadScreenItemId.equalsIgnoreCase("none")){ @@ -484,9 +500,4 @@ -} - - - - - +} ================================================================
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
05/31/13 09:12 AM (10 years ago)
Cool. I changed stuff in the layout file to get rid of any extra stuff and center the video as well. screen_at53_video_player.xml try this https://dl.dropboxusercontent.com/u/39276137/AT53CenteredXML.txt
 
satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
like
05/31/13 09:20 AM (10 years ago)
Wow!!! It's Work Perfect. there are no a play image button any more. Thank you again Satit P.
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
05/31/13 09:31 AM (10 years ago)
nice!
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
06/01/13 12:08 PM (10 years ago)
ok so basically you two got rid of the play button and let music stream upon opening? LA
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
06/01/13 12:10 PM (10 years ago)
yep
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
06/01/13 12:11 PM (10 years ago)
Awesome! LA
 
GJvanWijk
I hate code!
Profile
Posts: 95
Reg: Dec 19, 2011
location unknow...
6,000
like
07/07/13 07:12 AM (10 years ago)
Is there a simular solution for iOs? Regards Gert-Jan
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
07/07/13 03:25 PM (10 years ago)
Hi GJ, When I get to my Mac tonight I'll send post some code. Cheers! Ian
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
07/07/13 08:17 PM (10 years ago)
HI GJ, here is a link to the code I use in the IOS version. Look for these two .h and .m files in your Xcode project. You will need to use your app delegate name where "yourapp" appears in the app delegate.m file. Hope this helps and keep me posted ian At53_video_player.h https://dl.dropboxusercontent.com/u/39276137/At53Video_H_IOS_Edited.rtf At53_video_player.m https://dl.dropboxusercontent.com/u/39276137/AT53Video_M_IOS_EditedCode.rtf
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
07/08/13 06:33 AM (10 years ago)
awesome @ian :) thanks!
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
07/08/13 08:53 AM (10 years ago)
Hi GJ, That videos are playing fine. I am sending a dropbox link of the project to your email address. I think you may have had it right the first time with the code I sent but the video files were not being recognized in the bundle (you may have seen an error in Xcode about file not being found) Here is a screen shot as an example to make sure your files are properly added to your bundle so the app can use the files. https://dl.dropboxusercontent.com/u/39276137/Xcode_BuildPhases_AddTarget.png keep me posted! cool app. I studies with Don Lawrence in NY and Guy Babuzek in La. cheers! ian
 
NatHarman
I hate code!
Profile
Posts: 32
Reg: Apr 16, 2013
Cardiff
320
like
08/21/13 06:01 PM (10 years ago)
Can we loop the video player and auto play?
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.