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

XMLPullParserException in Android Application
Can't get the string value in Hash Map on List view adapter in Android
Android: REmove icon from springboard and launch this application from other application
Unable to find seq points for method '(wrapper managed-to-native) System.Diagnostics.Debugger:Mono_UnhandledException_internal (System.Exception)'
Installing Eclipse Market on Android Bundle
Logo on website in webview displays in low quality
Can't check whether language is available. TextToSpeech android
Android app with multiple MasterFlow/Activities layouts example?
Detect if (Android) phone encryption is enabled
View Pager in Fragment
Setting wallpaper image to fit screen
TextView android:ellipsize=“marquee” not working as expected
IBM Worklight 5.x - Android app stops and terminates unexpectedly
Android - Google Play Store closes app for update and not opening it afterwards
getting text from edit text in input dialog
time going back on Android

Categories

HOME
android
asp.net-web-api
azure-stream-analytics
google-cloud-platform
cobalt
forms
3d
vscode-extensions
edge
nsbundle
alsa
nstableheaderview
bing-maps
qpython
octave
watson-conversation
libc
entitymanager
null-pointer
jersey-1.0
imagemap
backpack-for-laravel
aggregation
handler
android-things
quantlib
ntp
scatter3d
kodi
linkedhashmap
card.io
yowsup
alphabetical
reactivekit
timing
android-augmented-reality
recurrent-neural-network
skylink
postgresql-8.4
naming
fwrite
xbmc
openresty
linter
serde
globalize
reportservice2010
activeperl
page-replacement
skin
type-theory
testrail
smartfoxserver
chromium-os
cudd
windows-azure-queues
hclust
dup
expectations
google-query-language
ellucian-scribe
database-relations
invoke-sqlcmd
piracy-prevention
jaunt-api
state-restoration
xenomai
pypiserver
binomial-theorem
ember-cli-rails
liquid-layout
git-ftp
fits
execve
post-commit-hook
jqmodal
mintty
renderer
facebook-timeline
css-reset
video-codecs
onload-event
cakephp-1.2
pyunit
database-create
floating-point-exceptions
webdev.webserver
cuteeditor
presentation-layer
folding
filesystemobject
feasibility
tui
google-wave
fail-fast-fail-early
technical-debt
image-capture

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