Commit graph

323 commits

Author SHA1 Message Date
Vasiliy
36a34bd477 Merge branch 'dev' into playback_state_list 2019-04-27 17:37:43 +03:00
Tobias Groza
a0690d3d2b Merge remote-tracking branch 'TeamNewPipe/dev' into close_button 2019-04-13 18:18:17 +02:00
Vasiliy
2e36b05a50 Implement playback state management 2019-04-13 13:34:36 +03:00
Stypox
763ad613d4 Implemented share button in MainVideoPlayer
Android Studio also decided to change the indentation of some lines
2019-04-06 20:27:13 +02:00
Ritvik Saraf
abcbc333e5 seek on clicking timestamp links in comments 2019-03-13 07:01:24 +05:30
Robin
b2d3879610 Merge branch 'exoplayerupdate' of https://github.com/Redirion/NewPipe into exoplayerupdate 2019-03-06 09:38:17 +01:00
Robin
924b16c9ef Fix for wrong case after language normalization 2019-03-06 09:37:55 +01:00
Redirion
72a82a31f2 Merge branch 'dev' into exoplayerupdate 2019-03-05 21:44:27 +01:00
Tobias Groza
c8ed67f8be Update app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java
Co-Authored-By: Redirion <redirion@web.de>
2019-03-05 20:57:05 +01:00
Robin
b84c243445 Removed unused import 2019-03-05 19:54:37 +01:00
Robin
86c1328adf NOTE for legacy version: Removed Lint markers and completely dropped Jelly Bean workarounds 2019-03-05 19:48:39 +01:00
Robin
63e02fae7a Update ExoPlayer to 2.9.6, including httook dependency and deprecations 2019-03-05 18:05:44 +01:00
Redirion
694688cd85 Merge branch 'dev' into patch-1 2019-03-05 17:57:52 +01:00
Redirion
38d7dc7140 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
Redirion
100197d1a9 Cache duration String to improve performance
In VideoPlayer the Duration String is cached effectively by setting it to the playbackSeekBar. As the playbackSeekBar doesn't exist in BackgroundPlayer, using two addition variables will reduce performance impact of notification updates by almost 50% and thus perform similar to VideoPlayer.

This addresses issue #2170
2019-03-04 10:24:08 +01:00
Vasiliy
c174bc77f0 Fix AudioManager memory leak 2019-02-24 10:51:30 +02:00
Vasiliy
dab0036069 Merge branch 'dev' into close_button 2019-02-23 13:19:09 +02:00
Christian Schabesberger
5f5c7575d0 Merge branch 'dev' into dev 2019-02-19 17:35:49 +01:00
Christian Schabesberger
fa6cf0f345 Merge branch 'dev' into patch-1 2019-02-19 14:29:34 +01:00
kapodamy
dd80d24482 fix crash while switching from popup to fullscreen player, or closing the popup player. 2019-02-17 16:59:35 -03:00
Ritvik Saraf
4113e744c4 merged upstream/dev 2019-02-16 02:06:18 +05:30
Redirion
2e284ea3dc Fix delayed ducking of Audio
Scenario: listening to a video on NewPipe over Bluetooth and a Notification Sound causes audio focus event AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK.

Problem: With the current implementation animateAudio would cause the audio to reach the target volume AFTER the notification sound is played, which is irritating and annoying.

Solution: animateAudio should just be used on focusGain where it is sensible to increase audio gradually. On ducking event the reaction should be immediate.

This very simple fix does this. Please approve.
2019-02-14 09:52:46 +01:00
Christian Schabesberger
725b59d0a3 Merge branch 'dev' into ccc 2019-01-31 16:48:22 +01:00
Robin
442a38babc Add Artist and Duration to MediaDescription 2019-01-31 16:47:33 +01:00
Christian Schabesberger
4365f956f9 further compatiblity fix for meadic.ccc 2019-01-29 15:39:18 +01:00
Vasily
d11f7414e4 Show close button when playing completed 2018-12-27 16:51:48 +02:00
Ritvik Saraf
f3b2724975 merged upstream/dev 2018-12-20 08:51:44 +05:30
Christian Schabesberger
194eee9e64 Merge branch 'dev' into giga-postprocessing 2018-12-10 12:12:38 +01:00
kapodamy
f6db08404e Merge branch 'dev' into giga-postprocessing 2018-12-05 01:15:39 -03:00
Ritvik Saraf
5d659c24dc merged upstream/dev 2018-12-04 23:19:57 +05:30
Shivanju Awasthi
dbcaa2b00d Merge branch 'dev' into auto_queue_logic 2018-12-04 16:22:18 +00:00
Christian Schabesberger
31e4869673 Merge branch 'dev' into giga-postprocessing 2018-12-01 09:30:38 +01:00
Christian Schabesberger
112d21b20d Merge branch 'dev' into auto_queue_logic 2018-12-01 09:29:25 +01:00
Akash Agarwal
23272c7d1c Issue 1505: Delete on right swipe 2018-12-01 00:42:56 +05:30
kapodamy
0f8924d167 Merge branch 'dev' into giga-postprocessing 2018-11-28 22:53:29 -03:00
Shivanju Awasthi
d57fefafae Merge branch 'dev' into auto_queue_logic 2018-11-26 22:56:01 +05:30
Ping20002015
cc7f368d0e Merge branch 'dev' into master 2018-11-26 18:00:22 +01:00
shivanju
79cc4e9633 issue:1336 Remove auto queued stream if a new stream gets appended 2018-11-24 17:35:17 +05:30
Ping20002015
6cf1cbec0b Fix NPE for issue #1901 2018-11-23 19:38:01 +01:00
kapodamy
c7e1b5b9ef Merge branch 'dev' into giga-postprocessing 2018-11-15 20:53:30 -03:00
Christian Schabesberger
a36340d881 set minSdk to 19 and deprecate old player 2018-11-13 17:27:47 +01:00
shivanju
e742987b1a issue:1336 Fix for inserting new streams when auto queuing is enabled 2018-11-11 16:24:49 +05:30
kapodamy
4d6cfd2043 resbase (08/11/2018) 2018-11-08 22:00:13 -03:00
kapodamy
21e205a6be 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
Nitin Khanna
df474e59c4 pop-up player crash fixed 2018-11-07 22:01:39 +05:30
Christian Schabesberger
b027846945 fucking android bullshit 2018-10-27 09:57:11 +02:00
Christian Schabesberger
7374618add fix race condition when returning to main player 2018-10-26 14:59:49 +02:00
Ritiek Malhotra
4f9978b663 Merge branch 'dev' into separate-gesture-options 2018-10-10 08:41:42 -07:00
Christian Schabesberger
6f9bb027b1 Merge branch 'dev' into enqueue-autoplay 2018-10-06 17:35:55 +02:00
Coin
e442594640 Enqueuing now triggers video playing if the play queue has done playing 2018-10-03 00:31:28 +08:00