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 to live stream video from camera using texture view and not surfaceview?
Event handler for the end of results in Bing speech client library in android in LongDictation mode
Not taking value from json array in android?
Bamboo integration for Android application
On swipe my image move left or right
How to set NavigationView's headerView with Anko DSL?
Android 6.0+ Unable to resume activity , did not call finish() prior to onResume() completing
Binary XML file line #13: Binary XML file line #13: Error inflating class fragment
Android:Device Pin\Swipe Screen not shown when notification action button pending intent is set to start service
How to invoke android app from Xamarin Android app
Android link specific words in textview which is variable
WiFi connection issues when BLE scan always on
Qt Quick Controls 2 Scaling
Uninstall app then install new app programmatically
Audio crashes after pressing the buttons a few times
How to have a view over several activities

Categories

HOME
awk
alexa-skills-kit
jmx
toolbox
rendering
static-site
permissions
emscripten
jetty
python-multithreading
azure-container-service
retrofit2
qpython
fosrestbundle
mql5
32bit-64bit
enthought
project-intu
alamofire
jsonpath
tput
code-generation
mvc-mini-profiler
android-7.0-nougat
vuejs
exit
game-theory
outliers
tizen-tv
google-earth
constexpr
testbed
deltaspike
simplecv
getpixel
hibernate-search
sharding
reverse
numpy-broadcasting
searchkit
raft
google-earth-engine
reactivekit
metaprogramming
plaintext
parser-generator
importerror
strftime
optimizely
clarifai
rserve
zenhub
magic-draw
check-mk
bbpress
juice-ui
rocks
flex-monkey
xcode-server
spring-cloud-feign
uicolor
xdoclet
udpclient
appscale
sklearn-pandas
redis-cluster
fuzzywuzzy
libav
extjs-grid
coda
canalyzer
rpart
mraid
uvc
zend-currency
dot.js
qtwebengine
infosphere-spl
punycode
jama
insight.database
authlogic
dsym
getopt
sbcl
artemis
hidapi
http-status-code-410
sqlclr
tree-balancing
pstack
sentestingkit
appledoc
presentation-layer
lalr
google-wave
product-management
online-storage

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