android


Change to Full Screen and Small Screen Player based on Orientation changes


I am using ExoPlayer library to create Video Player, here is what I have achieved.
Now I would like to know How can I play video in FullScreen mode, if phone Orientation changed to Landscape and back to Small Screen once orientation changed to Portrait.
public class MainActivity extends Activity implements PlaybackControlLayer.FullscreenCallback {
private ImaPlayer imaPlayer;
private FrameLayout videoPlayerContainer;
private ListView videoListView;
boolean isFullScreen = false;
ArrayList<Videos> videosArrayList;
VideosAdapter videosAdapter;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View view = getLayoutInflater().inflate(R.layout.activity_main, null);
.....
videoListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
if (imaPlayer != null) {
imaPlayer.release();
}
videoPlayerContainer.removeAllViews();
imaPlayer = new ImaPlayer(MainActivity.this,
videoPlayerContainer,
videosArrayList.get(i).getVideo(),
videosArrayList.get(i).getTitle());
imaPlayer.setFullscreenCallback(MainActivity.this);
imaPlayer.play();
}
});
setContentView(view);
}
#Override
protected void onDestroy() {
if (imaPlayer != null) {
imaPlayer.release();
}
super.onDestroy();
}
#Override
public void onGoToFullscreen() {
isFullScreen = true;
videoListView.setVisibility(View.INVISIBLE);
}
#Override
public void onReturnFromFullscreen() {
videoListView.setVisibility(View.VISIBLE);
}
#Override
public void onBackPressed() {
Log.d("boolean:-", Boolean.toString(isFullScreen));
if(isFullScreen) {
imaPlayer.getContentPlayer().setFullscreen(false);
}
else {
super.onBackPressed();
}
}
Here is how activity looks in Manifest:
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:label="#string/app_name">
......
</activity>

Related Links

How add float x and float y values in MPAndroidChart
Hi! how can i go into the layout which i selected from the spinner?
How to determine the version of Gradle?
Uiautomator- how to get the text value on the textview obj of which the checkbox value is checked??
Where do some of the app permissions come if they are not specified in the AndroidManifest? [duplicate]
Import tests from eclipse to android studio
APN setup programatically in android
Videoview measure to fit a layout with exactly ratio
How can send this json to server with content type as application/x-www-form-urlencoded in android
Android studio SDK manager is not working
onLocationChanged in asynctask android
Iterate through a Hashmap and store values in variables for use
Android Emulator on Jenkins error: device offline
Alert Dialog negative button to same activity
How to list out manually searched network operator in out list view?
android hide keyboard method(error when focus lose)

Categories

HOME
httparty
google-cloud-platform
numbers
alarm
javacc
spring-data-mongodb
scripting
ado.net
x264
spring-session
data-visualization
boto3
title
okhttp
google-chrome-app
distribution
google-form
cumulocity
dimensional-modeling
xmonad
pyramid
shortest-path
cfml
backpack-for-laravel
named-entity-recognition
tosca
tiki-wiki
android-sharedpreferences
realm-mobile-platform
nsurl
volatile
cart
openwhisk
nested-lists
gdata
cin
google-data-api
parser-generator
lpsolve
android-checkbox
httrack
lampp
singleinstance
android-testing
template-toolkit
vibrate
rocks
pure-css
atlas
async.js
firebase-security
qiime
deep
php-socket
dynamics-nav-2016
computer-architecture
jdk1.7
rdflib
osc
j-security-check
zxspectrum
actionfilterattribute
phpldapadmin
iiop
crowd
paw
ignite-ui
malformedurlexception
xml-dsig
twitter-bootstrap-rails
websphere-esb
rfc5322
insert-id
windows-98
pstack
appjs
isa-swizzling
cross-database
django-paypal
vs-android
pagemethods
glui
purepdf
dojo-dnd
fail-fast-fail-early
xslcompiledtransform
appliance

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App