Android: Video Player Like Dailymotion App - java

I want to develop video player like dailymotion app. The main thing that i want to achieve is it's rotation behaviour and full screen button action. When user rotate device or tap on full screen button the video player goes to full screen and video play continue without any intruption.
Currently i am using video view widget for Stream video. but when user rotate device. the video stop and video view activity reload and video view intilize again and then video play.
So please suggest me solution of this problem. Thanks in advance.

You can use below flags when registering your activity in manifest file
android:configChanges="orientation|screenSize|keyboardHidden"
and then in you activty class just override "onConfigurationsChanged()" method so that your activity won't restart when orientation changes.
One thing that you can try is to save video current position in "onConfigurationChanged()" so that after rotation when VideoView reinitialize itself you can continue to play video from that position.

ues ExoPlayer as base class and extend it as your own Custom Player. these issues are handled here. this is available on official android developer site
http://developer.android.com/guide/topics/media/exoplayer.html

Related

Sending content of videoview from one activity to next acvity's video view

I have a video playing in videoview in first activity. I want to to go to second activity and it should continue to play the same video (the video should not restart) in the videoview of second activity.
I am thinking to use intent to pass it's contents to video view of second activity , but I am wondering about how to resume the video from the same point.
Please help me. If any link or article is there related to that, please let me . It will be very helpful for me.
Thanks in advance.
To achieve the best result, use "Fragment" to display the video and also add another fragment to the same activity to display and do other stuff as you intend to do.

coding button to video

Program: android studio
hello
I'm trying to create a button that when I press on it, a full screen video show up. But the problem is when I set a VideoView it shows a gray screen on top of my play button.
What I want, is to make the VideoView invisible and completely white and use the button to play a full screen video without having any gray box covering my screen.
Call
videoView.setZOrderOnTop(false);
before playing the video, and
videoView.setZOrderOnTop(true);
after .start()
Alternatively you can use
videoView.setBackgroundColor(Color.TRANSPARENT)
Whichever one is applicable

Open mp3 files in android default media player on the same activity

I am developing an Android application in which I am showing a ListView of mp3 files from the sd card.
Now what I want is that when user clicks on any of the mp3 files it should start playing there on the same Activity. The code which I am using presently is not working for me to play audio files.
My code:
Uri uri = Uri.parse("/sdcard/music/sample.mp3");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
But this is something that I want. This is a screen Shot form android gingerbread
see this link here is a good example of getting all the music files and show in list and play when you click any item...
Display MusicList and play on itemClick
Another link
I suppose you should use another approach in case you want audio played in the same activity. I'd better initialize MediaPlayer object in this activity or as a background service.
In case of any questions feel free to ask.
UPDATE 1
In general case as I said you either need the MediaPlayer object in Activity or Music Service.
Now lets talk about controls.
You can simply put into your layout the block with controls and show/hide it when needed. MediaPlayer provides several convenient callbacks, so you will be able to update progressbar.
So, sum up:
Include controls into layout.
Include MediaPlayer into activity or make it work as a Service.
Bond controls to player.
???
PROFIT

When I Intent to open standard video player, can i strip the gallery interface or reroute it?

I open a video in my application with an intent to the default player. It shows a gallery in the top left that would go to the gallery for the device which I don't want. Is there a way to customize it so that either that icon will fire the equivalent of the back button OR just remove it altogether?
I was thinking there were params in the intent or something that would be interpreted by the activity.
Goal: I want to be able to launch default player without the top nav bar. I feel it is something that i should just create my own VideoView for, instead of using a default player. I just didnt want the gallery button to point back to the gallery. Feel that might be some confusion.
I havent seen anything that told me of optional parameters i could pass into the video activity.

Can I set the GLSurface view(Animation) as my background?

I'm developing a media player application in Android. I've an animation (Open Gl Surface View) which should run in background to my Activity when song is being played. Like the animation which we see when we are playing Windows Media Player.
How can I achieve the above scenario?
You can add glSurfaceView as a child to your main view.
something like:
mainLayout.addView(glSurfaceView);
this.setContentView(mainLayout);
the scenario you describe is pretty vague.
what you'll want is to create an activity that will have a GLSurfaceView with all you animations and interface, and running in a separates Thread your media playing code.
if this is not what your asking please give us more details
Jason

Categories

Resources