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

Android: why Thread in getView() does not seem to work?
Android play services 6.5.87 force stop
android espresso testing : empty test suite. no tests were found
Why volatility does not return anything from running linux_pslist
Unable to display image in curlview
Android image list view using json
Android phone “DCD ON” error, constantly running in Logcat
How to redirect to Android app/play store from an Android notification of a Facebook Request?
Strange light green background color for selected option in selectmenu jquery mobile and cordova 4 cli
How to code for Smartwatch 2
translationY view animation jumps to the end
Android: hide / show table rows
Convert thumbnail to image
Can access new gmail api by using GoogleApiClient(Android)?
animation on circleview like headspace in android
Android - Cut audio file for 2 seconds in beginning and 1 second in end

Categories

HOME
sonarqube
django
jpa
github-for-windows
3d
battery
gradient
ms-access-2016
bitbucket-api
database-normalization
simulink
settings
vsm
fosrestbundle
resultset
renjin
mongodb-csharp
nim
monit
displaytag
beta
mount
froala
google-cloud-print
inversion-of-control
android-things
anki
utorrent
testbed
turfjs
quickfixj
glib
dsx-desktop
jpad
android-augmented-reality
urlsession
xv6
visa
lpsolve
placeholder
vaadin-charts
monkey-testing
optimizely
double-click
magento-2.0.7
robomongo
facebook-pixel
stdmap
android-testing
git-flow
quicktime
lsyncd
baidu
juice-ui
winusb
eigenvector
thread-sleep
invoke-sqlcmd
np-spring
highland.js
character-replacement
video-player
dulwich
cwrsync
mraid
mmwormhole
public-html
cryptographichashfunction
ejb-2.x
viewer
punycode
mobility
alternate
qscrollarea
kogrid
nebula
merb
asplinkbutton
joomla3.1
android-loadermanager
hibernateexception
urlrewriter
instantiationexception
easyb
qtabbar
murmurhash
strtod
data-mapping
windows-identity
todos
java1.4
wspbuilder

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