Commit Graph

89 Commits

Author SHA1 Message Date
Avently 6fc91312d2 Changed default autoplay type to "Only on WiFi" 2020-01-09 19:27:10 +03:00
Avently 4c57893312 New features and fixes
- added autoplay options inside settings: always, only on wifi, never
- now statusbar will be shown in fullscreen mode
- playlists, channels can be autoplayed too (if enabled)
- changed title of background activity to Play queue
- fixed a crash
2020-01-08 19:16:50 +03:00
Robin bf2a3ca043 Migrate to AndroidX 2019-10-04 14:59:08 +02:00
Robin 4d80bdcc9f Update ExoPlayer to 2.9.6, including httook dependency and deprecations 2019-03-05 18:05:44 +01:00
Redirion d8b80f961a
Improved performance of getTimeString
This pull requests complements pull request  #2178 by reducing general computational time for the method getTimeString.

On my local machine (Desktop PC with Java) my tests with a sample size of 10000 calls to the method with param 86400001 showed a performance improvement of about 50%.

See sample code below to reproduce:

    private static final StringBuilder stringBuilder = new StringBuilder();
    private static final Formatter stringFormatter = new Formatter(stringBuilder, Locale.getDefault());
    
    public static String getTimeString(int milliSeconds) {
        int seconds = (milliSeconds % 60000) / 1000;
        int minutes = (milliSeconds % 3600000) / 60000;
        int hours = (milliSeconds % 86400000) / 3600000;
        int days = (milliSeconds % (86400000 * 7)) / 86400000;

        stringBuilder.setLength(0);
        return days > 0 ? stringFormatter.format("%d:%02d:%02d:%02d", days, hours, minutes, seconds).toString()
                : hours > 0 ? stringFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString()
                : stringFormatter.format("%02d:%02d", minutes, seconds).toString();
    }
    
    public static String getTimeStringL(int milliSeconds) {
        long seconds = (milliSeconds % 60000L) / 1000L;
        long minutes = (milliSeconds % 3600000L) / 60000L;
        long hours = (milliSeconds % 86400000L) / 3600000L;
        long days = (milliSeconds % (86400000L * 7L)) / 86400000L;

        stringBuilder.setLength(0);
        return days > 0 ? stringFormatter.format("%d:%02d:%02d:%02d", days, hours, minutes, seconds).toString()
                : hours > 0 ? stringFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString()
                : stringFormatter.format("%02d:%02d", minutes, seconds).toString();
    }
    
	public static void main(String[] args) throws Exception {
		final int SAMPLE_SIZE = 25000;
		long[] results = new long[SAMPLE_SIZE];
		for(int i = 0; i < SAMPLE_SIZE; i++) {
			long now = System.nanoTime();
			getTimeString(86400001);
			results[i] = System.nanoTime() - now;
		}
		long sum = 0;
		for(int i = 0; i < SAMPLE_SIZE; i++) {
			sum += results[i];
		}
		System.out.println("Average execution time: " + (sum/SAMPLE_SIZE));
		results = new long[SAMPLE_SIZE];
		for(int i = 0; i < SAMPLE_SIZE; i++) {
			long now = System.nanoTime();
			getTimeStringL(86400001);
			results[i] = System.nanoTime() - now;
		}
		sum = 0;
		for(int i = 0; i < SAMPLE_SIZE; i++) {
			sum += results[i];
		}
		System.out.println("Average execution time: " + (sum/SAMPLE_SIZE));
2019-03-04 15:45:59 +01:00
Ritvik Saraf f19cfb75e6 merged upstream/dev 2018-12-20 08:51:44 +05:30
Christian Schabesberger 6035be9ce6
Merge branch 'dev' into giga-postprocessing 2018-12-10 12:12:38 +01:00
Ritvik Saraf 9b84046865 merged upstream/dev 2018-12-04 23:19:57 +05:30
kapodamy 7e9bcff0f3
Merge branch 'dev' into giga-postprocessing 2018-11-28 22:53:29 -03:00
Shivanju Awasthi e911dbb9d4
Merge branch 'dev' into auto_queue_logic 2018-11-26 22:56:01 +05:30
Christian Schabesberger 25d6806ebd set minSdk to 19 and deprecate old player 2018-11-13 17:27:47 +01:00
shivanju 47c3da131c issue:1336 Fix for inserting new streams when auto queuing is enabled 2018-11-11 16:24:49 +05:30
kapodamy 5825843f68 main commit
Post-processing infrastructure
* remove interfaces with one implementation
* fix download resources with unknow length
* marquee style for ProgressDrawable
* "view details" option in mission context menu
* notification for finished downloads
* postprocessing infrastructure: sub-missions, circular file, layers for layers of abstractions for Java IO streams
* Mp4 muxing (only DASH brand)
* WebM muxing
* Captions downloading
* alert dialog for overwrite existing downloads finished or not.

Misc changes
* delete SQLiteDownloadDataSource.java
* delete DownloadMissionSQLiteHelper.java
* implement Localization from #114

Misc fixes (this branch)
* restore old mission listeners variables. Prevents registered listeners get de-referenced on low-end devices
* DownloadManagerService.checkForRunningMission() now return false if the mission has a error.
* use Intent.FLAG_ACTIVITY_NEW_TASK when launching an activity from gigaget threads (apparently it is required in old versions of android)

More changes
* proper error handling "infrastructure"
* queue instead of multiple downloads
* move serialized pending downloads (.giga files) to app data
* stop downloads when swicthing to mobile network (never works, see 2nd point)
* save the thread count for next downloads
* a lot of incoherences fixed
* delete DownloadManagerTest.java (too many changes to keep this file updated)
2018-11-08 19:00:44 -03:00
Ritiek Malhotra 046740f10b
Merge branch 'dev' into separate-gesture-options 2018-10-10 08:41:42 -07:00
BO41 0ab86937d2 data flow issue + declaration redundancy
make final
unused methods
make final

BUILD SUCCESSFUL in 0s
39 actionable tasks: 39 up-to-date
2018-09-11 19:18:41 +02:00
Ritiek Malhotra 5931cd6af7 Separate options for volume and brightness gestures 2018-08-31 19:30:40 +05:30
Mauricio Colli 8a29cfbb7e
Remove popup shutdown gesture in favor of the new close overlay 2018-08-22 23:58:12 -03:00
John Zhen Mo 0fcef064fb -Reduced fling speed required to close popup by 40%. 2018-06-28 11:58:33 -07:00
John Zhen Mo 7721098551 -Updated ExoPlayer to 2.8.0
-Updated MediaSource contracts in ManagedMediaSource.
-Changed PlaceholderMediaSource and FailedMediaSource to use built-in BaseMediaSource implementation.
-Changed deprecated DynamicConcatenatingMediaSource to ConcatenatingMediaSource.
-Removed manual playlist media source disposal in favor of player built-in disposal.
2018-06-28 11:58:32 -07:00
John Zhen Mo e1df4757e4 -Expanded minimize to exit to allow resuming on background player.
-Modified minimize to exit toggle to selection dialog.
2018-06-03 14:09:16 -07:00
John Zhen Mo 4fc37a7321 -Added toggle to allow main video player to switch to popup player when onstop is called.
-Fixed player state not recovering when player is stopped during multiwindow mode.
-Updated gradle to 3.1.2.
2018-06-03 13:20:39 -07:00
Andrei.Rosca ef180f082e Remember brightness for the session 2018-06-02 09:06:40 +02:00
Christian Schabesberger a099fe35d2 reorder playqueue/localPlaylist classes 2018-04-29 12:51:57 +02:00
Christian Schabesberger bcfd8a2450 rename playlist to player.playqueue 2018-04-29 12:49:52 +02:00
Christian Schabesberger 9484a5e2ee fix conflict 2018-04-14 11:02:31 +02:00
John Zhen Mo 238bff1fee -Modified adaptive track selection to upgrade with 1 second of buffer.
-Modified dynamic track updates to seek to default time instead of clamping to 0 time when negative progress is reached.
2018-04-11 20:27:38 -07:00
John Zhen Mo f3d777c65c -Added accessibility caption style and text color resolver.
-Added button to open captioning settings activity from appearance settings.
-Modified player captions to use custom caption style when captioning manager is enabled.
-Removed caption size settings from appearance settings.
2018-04-08 13:58:55 -07:00
John Zhen Mo 18d019c62a -Added quadratic slider strategy implementation and tests.
-Modified playback speed control to use quadratic sliders instead of linear.
-Modified number formatters in player helper to use double instead of float.
-Simplified slider behavior in playback parameter dialog.
-Fixed potential NPE in base local fragment.
2018-03-21 20:08:33 -07:00
Mauricio Colli 83b084a90b Implement subscriptions import/export
- Import subscriptions from YouTube and SoundCloud (all services that the extractor support)
- Import/export a JSON representation of the subscriptions
- [Minor] Remove some javax annotations in favor of the one provided by the android support library
2018-03-08 10:39:24 -03:00
John Zhen Mo d01aeab242 -Added auto-queuing to allow next or related streams to queue up when the last item on play queue is playing.
-Added toggle to enable auto-queuing.
-Modified main video player to only pause the video onPause.
-Fixed main video player not saving play queue state onStop.
2018-03-04 20:16:38 -08:00
John Zhen Mo a88e19a8ed -Added toggle to enable fast inexact seek in players.
-Improved player sync calls to recognize different metadata updates.
-Changed MediaSourceManager to synchronize only after timeline changes and reenabled multiple sync calls to player.
-Renamed listener and synchronization methods related to MediaSourceManager.
2018-03-03 14:24:21 -08:00
John Zhen Mo b4668367c6 -Added better assertions and documentations to new mechanism in MediaSourceManager.
-Modified LoadController to allow fast playback start and increased buffer zigzag window.
-Removed unnecessary loading on timeline changes.
-Changed select message in MediaSourceManager to cause immediate load.
-Reduced default expiration time in MediaSourceManager.
-Fixed main video player not showing end time on audio-only streams.
-Fixed live stream has player view disabled after transitioning from audio stream.
-Fixed inconsistent progress bar height between live and non-live video on main player.
2018-02-28 17:45:05 -08:00
John Zhen Mo b3b2748bb7 -Improved player queue stability by using more aggressive synchronization policy.
-Added sync buttons on live streams to allow seeking to live edge.
-Added custom cache key for extractor sources to allow more persistent reuse.
-Refactored player data source factories into own class and separating live and non-live data sources.
2018-02-26 19:57:59 -08:00
John Zhen Mo c1a302834c -Fixed auto-generated string not translatable. 2018-02-20 21:15:23 -08:00
John Zhen Mo d936ca6b89 -Added view registration on repeats.
-Added drag reorder speed clamping to play queue list.
-Fixed service player activity memory leak.
-Fixed media source manager sync disposable fallthrough causing NPE.
-Fixed thread bouncing during play queue item async stream resolution.
-Updated ExoPlayer to 2.6.0.
2018-02-20 21:15:23 -08:00
John Zhen Mo 880676d670 -Modified popup video player to show extra options only when screen is large enough.
-Modified available resize options for different player modes.
-Fixed caption menu not working on popup player.
-Extracted hardcoded strings.
-Added button effects to both main and popup players.
2018-02-11 11:32:39 -08:00
John Zhen Mo 5773152ed3 -Added subtitles loading and display.
-Added subtitles switching button to popup and main players.
-Added aspect ratio switching button to popup pand main players.
2018-02-11 11:31:49 -08:00
John Zhen Mo 38b2ffd450 -Added fling to toss popup view when velocity is below shutdown.
-Added string for unknown content.
-Fixed NPE when UI element is touched after player shuts down in service activity.
-Fixed shuffle reset caused by position discontinuity offsets index.
-Moved some more player shared preferences to PlayerHelper.
2017-11-11 14:48:16 -08:00
John Zhen Mo 1fb3774e03 -Changed play queue item building to shrink thumbnail before caching.
-Renamed refactor directory in player to helper.
-Fixed background player notification update causing lag on older spec models.
-Fixed service activity theme not changing after user setting is changed.
-Fixed NPE on popup player fling to close.
-Fixed audio reactor volume and max volume mixup.
-Added correct toast for each player error case.
-Fixed button coloring for play queue service activity on landscape.
-Changed title and uploader text to marquee for vertical service activity.
-Removed cache clearing on every thumbnail load.
2017-10-30 20:58:47 -07:00