-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix exoplayer aspect ratio update on source changes #2053
Fix exoplayer aspect ratio update on source changes #2053
Conversation
This solutions looks good, I fixed it in a different way on my fork. Is there a problem if we always remeasure when video size changes? jenshandersson@a2440ac |
Theoretically video size could change during playback eg if it's HLS playlist... |
@jenshandersson I tried to keep the behavior of only measuring layout on first size change event. But I don't see any problem in recalculating the layout every size change. maybe @AndrewJack, who did the PR #426, could help us there? |
@jefersondaniel I solved my problem perfectly through your method. Thank you |
@jefersondaniel can you add a note in CHANGELOG and I will merge in! |
@jenshandersson done |
…2053) * Fix exoplayer aspect ratio update on source changes * Update CHANGELOG.md
* Fix so background audio from other apps can play when disableFocus is true. requestAudioFocus was being run regardless of there being a src, so I made it so that only gets requested when a src exists. * Added details to readme and changelog * update for androidX * change minSdkVersion back to 16 * update readme * remove duplicate ReactVideoPackage() * add readme to migrating to AndroidX * add read me * fix read me * pre androidX, upgrade to 28 * remove duplicated line in example * change dead code in example * Remove calls to [super observe] to fix crash * Add TheWidlarzGroup#1646 to changelog * bring back super KVO with selector check * Fix memory leak when using AVPlayerViewController, make sure to release player * Updated changelog * changelog for TheWidlarzGroup#1629 * bump version * chang maven to google * fix when controls & muted * update changelog * handle racing conditions when props are setted on exoplayer * fix for setControls * fix repeat * comment why postDelayed * remove extra whitespace * remove rnpm * 4.4.4 * Update README.md Make installation parts easier to link * Update README.md fix typo * Update README.md Make more obvious the changes needed via using diff * Update MainApplication.java fix indent * remove matchingfallbacks in example * prepare 5.0.0 version * cpck androidx * change minSdkVersion back to 16 (cherry picked from commit a96fa33) * update readme (cherry picked from commit 3ddcba3) * add readme to migrating to AndroidX (cherry picked from commit 976ebcc) * cpck readme * fix read me (cherry picked from commit ed25b3f) * chang maven to google (cherry picked from commit 8a8f215) * cpck * ad platform installation to TOC (cherry picked from commit b0737bd) * More update info (cherry picked from commit 2f23cc0) * 5.0.1 * Fixed Exoplayer doesn't work with mute=true TheWidlarzGroup#1696 * Updated README.md to include instructions for React Native 0.60 and above * Removing the call to observeValueForKeyPath:ofObject:change:context: on super from RCTVideo. If the super class is not actually observing the key, the app will crash. Checking to see if the super class responds to this selector doesn't solve this issue. react-native-video github issue: TheWidlarzGroup#1515 Discussion about this particular problem: https://stackoverflow.com/questions/6574714/whats-wrong-with-this-observevalueforkeypathofobjectchangecontext-implement * Updated CHANGELOG to reflect bug fix in PR 1720 * added support for automaticallyWaitsToMinimizeStalling property on iOS * update readme * fix invert boolean property * bumped version & updated changelog * fix formatting issues * fix formatting fix crash iOS9 * changelog for TheWidlarzGroup#1696 * Update issue templates * Update bug_report.md * Update bug_report.md * Fix indent and respect previous rate * Bring the basic example back to a runnable state * Remove Exoplayer deprecations - Bump Exoplayer to 2.10.4 - Remove deprecated usages of Exoplayer methdos - Add `ReactExoplayerConfig` as extension points to configure the Exoplayer instance * Update changelog with Exoplayer update (TheWidlarzGroup#1766) * update package json version * update changelog version * Add disableFocus to TOC * fix typo in README * Clear progress messages on STATE_IDLE and STATE_BUFFERING (TheWidlarzGroup#1768) The progress message handler will duplicate recursions of the `onProgressMessage` handler on change of player state from any state to STATE_READY with `playWhenReady` is true (when video is not paused). This clears the messages on STATE_IDLE and STATE_BUFFERING to break the recursion. * fix README about reportBandwidth (TheWidlarzGroup#1816) * Fixes a situation when exiting fullscreen, where observed keypath values have not been released * add try catch block around removal of observer keypaths on playerViewController * Audio Poster issue fix (TheWidlarzGroup#1779) * Add full screen support to Android Exoplayer (TheWidlarzGroup#1730) * Bump version to 5.1.0-alpha * Fix readme grammar (TheWidlarzGroup#1888) * Improve Android Audio Focus (TheWidlarzGroup#1897) Implement audio focus as per android docs: https://developer.android.com/guide/topics/media-apps/audio-focus https://medium.com/androiddevelopers/audio-focus-3-cdc09da9c122 AUDIOFOCUS_LOSS should abandon focus and not try resuming audio, this is done with AUDIOFOCUS_LOSS_TRANSIENT This fixes at least: - Audio not being paused after focus being taken by some voip applications - Content resuming and pausing instantly sporadically (some race condition perhaps) when activity was resumed from background. * Update changelog (TheWidlarzGroup#1913) * docs(video): fix bufferConfig property name (TheWidlarzGroup#1855) * Fix play/pause regression after added fullscreen support. (TheWidlarzGroup#1916) * v5.1.0-alpha4 * Bump javascript dependencies (TheWidlarzGroup#1914) Also update linting rules to match other community repositories. * Add support for react-native Windows Cpp/WinRT (TheWidlarzGroup#1893) This also deprecates the old react-native windows implementation * Fix the `ref` sample code to remove the syntax error * Update changelog * v5.1.0-alpha5 * Don't set reactViewController view frame to whole screen (TheWidlarzGroup#1931) this fixes the case on any time you have a react view that displays the video, but it's being rendered with controls but not as a full screen (ie. easily reproducible when you have a tabbar for instance - the reactViewController.view frame shouldnt be the whole screen bounds). * Update onLoad event to include videoTracks info * add mixWithOthers prop * Update README.md * Update index.ios.js * Fix video dimensions for HLS streams * Changelog * Compare CGFloats instead * Update CHANGELOG.md * Update CHANGELOG, alpha-6 hasn't been released yet * Implement pending seek * Recommend npx pod-install for setup instructions # Summary We've been recommending devs use `npx pod-install` since it will attempt to install CocoaPods CLI if it's not available on the computer (cite [React Navigation setup guide](https://reactnavigation.org/docs/getting-started/#installing-dependencies-into-a-bare-react-native-project)). This has proved very useful for Expo users who are now migrating to the bare workflow and want to use community packages in their projects. ## Checklist - [x] I have tested this on a device and a simulator - [x] I added the documentation in `README.md` * Expose currentPlaybackTime when live stream video (TheWidlarzGroup#1944) * added trackId to exoplayer onLoad callback * added trackInfo to bandwidth callback * syntax fix * syntax fix * version update * sending complete logcat for media playback exception ExoPlaybackException * version bump * package publish changes * Live playback fix * Version bump * import fix * version bump * configurable preferredForwardBufferDuration * configurable preferredForwardBufferDuration * version update * Exposing time * exo player window current tsp * return type * Current window timestamp in epoch * iOS changes * version update * Updated package.json * updated version * CurrentTime bug fix * Updated package.json * Updated currentPlaybackTime * Updated currentPlayback logic * Updated package.json * Bug fix * Added semicolon * updated package.json * Updated ReactVideoView * updated verison * Revert package.json changes * Update ReactVideoView.java * Use standard log * Document preferredForwardBufferDuration (iOS) * Document currentPlaybackTime * Document trackId * Update CHANGELOG.md * Update CHANGELOG.md * Update README.md * Update CHANGELOG.md Co-authored-by: anubansal <[email protected]> Co-authored-by: Sivakumar J <[email protected]> Co-authored-by: parikshit <[email protected]> Co-authored-by: anubansal92 <[email protected]> Co-authored-by: Rishu Agrawal <[email protected]> Co-authored-by: rishu-curefit <[email protected]> * [ios] Adaptive fullscreen in landscape by device orientation (TheWidlarzGroup#1862) * update UIInterfaceOrientation in fullscreen * update code * Revert "[ios] Adaptive fullscreen in landscape by device orientation (TheWidlarzGroup#1862)" (TheWidlarzGroup#2043) This reverts commit c9096d1. * Upgrade exoplayer to 2.11.4 (TheWidlarzGroup#2034) * Removed JS fullscreening for Android (TheWidlarzGroup#2013) * Always set headers for iOS (TheWidlarzGroup#2014) * Support preventsDisplaySleepDuringVideoPlayback (TheWidlarzGroup#2019) * Add flag on iOS * Add flag in Android * Add documentation * Add changelog entry * Also set setKeepScreenOn * Fix prop not being set * add preventsDisplaySleepDuringVideoPlayback to exoplayer * Update android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java * Update android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java Co-authored-by: Jens Andersson <[email protected]> Co-authored-by: Anton Tanderup <[email protected]> Co-authored-by: Jens Andersson <[email protected]> * Fix exoplayer aspect ratio update on source changes (TheWidlarzGroup#2053) * Fix exoplayer aspect ratio update on source changes * Update CHANGELOG.md * Add iOS and Android basic DRM support (TheWidlarzGroup#1445) This PR adds support for DRM streams on iOS (Fairplay) and Android (Playready, Widevine, Clearkey) I am neither Android nor iOS developer, so feel free to provide feedback to improve this PR. **Test stream for ANDROID:** ``` testStream = { uri: 'http://profficialsite.origin.mediaservices.windows.net/c51358ea-9a5e-4322-8951-897d640fdfd7/tearsofsteel_4k.ism/manifest(format=mpd-time-csf)', type: 'mpd', drm: { type: DRMType.PLAYREADY, licenseServer: 'http://test.playready.microsoft.com/service/rightsmanager.asmx?cfg=(persist:false,sl:150)' } }; ``` or ``` { uri: 'https://media.axprod.net/TestVectors/v7-MultiDRM-SingleKey/Manifest_1080p.mpd', drm: { type: 'widevine', //or DRMType.WIDEVINE licenseServer: 'https://drm-widevine-licensing.axtest.net/AcquireLicense', headers: { 'X-AxDRM-Message': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiYjMzNjRlYjUtNTFmNi00YWUzLThjOTgtMzNjZWQ1ZTMxYzc4IiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImZpcnN0X3BsYXlfZXhwaXJhdGlvbiI6NjAsInBsYXlyZWFkeSI6eyJyZWFsX3RpbWVfZXhwaXJhdGlvbiI6dHJ1ZX0sImtleXMiOlt7ImlkIjoiOWViNDA1MGQtZTQ0Yi00ODAyLTkzMmUtMjdkNzUwODNlMjY2IiwiZW5jcnlwdGVkX2tleSI6ImxLM09qSExZVzI0Y3Iya3RSNzRmbnc9PSJ9XX19.FAbIiPxX8BHi9RwfzD7Yn-wugU19ghrkBFKsaCPrZmU' }, } } ``` **Test stream for iOS:** Sorry but I can not provide free streams to test. If anyone can provide test streams, or found some we can use, please let me know to also test them. It has been tested with a private provider and they work, at least with the `getLicense` override method. (An example implementation is provided in the README) * Ready 5.1.0-alpha6 for release * Prepare 5.1.0-alpha7 * Port over fix from 4.x branch * Prepare 5.1.0-alpha8 * Bugfix: TheWidlarzGroup#1930 * Add ARM64 support for windows (TheWidlarzGroup#2137) Adding arm64 support for RNW builds. Nothing in this project is using anything that isn't already supported in arm64 windows libs. It was simply overlooked when RNW was originally added. We have been using RNW and RNV in our project for 6+ months and just been using a patch-package to apply this change. Figured it was overdue to upstream this change. You can see this similar code in the RNW repo. https://github.com/microsoft/react-native-windows/blob/95935e008621778dbcec01363602c19abc060632/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/SampleLibraryCPP.vcxproj#L28 and https://github.com/microsoft/react-native-windows/blob/master/packages/microsoft-reactnative-sampleapps/windows/SampleLibraryCPP/SampleLibraryCPP.vcxproj#L44 * Update README.md (TheWidlarzGroup#2076) You only need to perform linking for React Native < 0.60 * fix: Xcode 12 compatibility (TheWidlarzGroup#2152) Latest Xcode 12 fails to build while without a module to depend on React-Core directly hence this change is necessary for native modules on iOS. This change requires to React Native 0.60.2 or newer. For more details please check: facebook/react-native#29633 (comment) * Renaming Boolean etc to AsBoolean (TheWidlarzGroup#2119) * Resolved an issue where setting a video to paused would ignore the “silent switch” setting * iOS DRM Fixes for License Fetching (TheWidlarzGroup#2208) * Update package.json version number to 5.1.1 * Update ReactNativeVideoCPP.vcxproj (TheWidlarzGroup#2288) * Exoplayer: Use okhttp version specified in gradle.properties (TheWidlarzGroup#2340) Because React Native uses okhttp, including exoplayer causes apps to use two different versions of okhttp. This results in some unpredictable behavior. Clients of `react-native-video` should be able to specify the same OKHTTP version to react-native and react-native video. See where it's specified in react-native trunk: - https://github.com/facebook/react-native/blob/master/ReactAndroid/gradle.properties#L15 - https://github.com/facebook/react-native/blob/e1b6cd3f756aa034b11af6bf9960efb42bde8692/ReactAndroid/build.gradle#L452-L453 * React Native Windows updates (TheWidlarzGroup#2206) Various updates for React Native Windows **Docs** * Fixed windows installation in readme * Added local dev setup instructions **Build** * Added VS solutions for RNW 0.61, 0.62, and 0.63+ * Added clang-formatting definition **Features** * Fixed autolinking for RNW 0.63+ * Added support for `rate` property **Examples** * Upgraded examples/basic to RN 0.61 and replaced broken windows app * Update README.md (TheWidlarzGroup#2292) Fix broken link for ignoresilentswitch * Fix AudoFocus pausing video when attempting to play (TheWidlarzGroup#2311) Fix AudioFocus bug that could cause the player to stop responding to play/pause in some instances. Fixes issue TheWidlarzGroup#1945 This was caused by the player requesting audio focus on each play (un-pause) and that resulted in a small window of Audio focus loss and then gain. The focus loss results in the player being paused while the player was supposed to play at the time. The solution is to keep track of Audio focus and not request new focus if we already have it. * Upgrade ExoPlayer to 2.13.2 (TheWidlarzGroup#2317) Upgrade ExoPlayer from 2.11.4 to 2.13.2 and fix any issues related to the upgrade and deprecated method use. * update exoplayer to allow pre-init and content clear * Fix for tvOS native audio menu language selector * Release 5.2.0-alpha1 * Typo * Release 5.2.0 * Use prop types from `deprecated-react-native-prop-types` Starting with React Native 0.68, using Prop Types from `react-native` emits a warning. * Update Video.js Co-authored-by: Elliott Kember <[email protected]> # Conflicts: # Video.js * Replace Image.propTypes with ImagePropTypes. # Conflicts: # Video.js * fix(Exoplayer): fix exoplayer version tà 2.13.3 * chore: fix build without exoplayer * v5.2.1 * docs: update Android installation * * removed duplicate method * * fix onRemotePlayPause in android * * remove duplicate code * * fix cannot find symbol after RN update --------- Co-authored-by: Kurt Johnson <[email protected]> Co-authored-by: Kurt Johnson <[email protected]> Co-authored-by: vok <[email protected]> Co-authored-by: Zaid Daghestani <[email protected]> Co-authored-by: Jens Andersson <[email protected]> Co-authored-by: Daniel Mariño Ruiz <[email protected]> Co-authored-by: Daniel Mariño <[email protected]> Co-authored-by: Ash Mishra <[email protected]> Co-authored-by: Andrew Chae <[email protected]> Co-authored-by: Jamie Halvorson <[email protected]> Co-authored-by: Nahuel Marisi <[email protected]> Co-authored-by: Jovan Stanimirovic <[email protected]> Co-authored-by: Benoit Dion <unknown> Co-authored-by: Benoit Dion <[email protected]> Co-authored-by: Bader Serhan <[email protected]> Co-authored-by: Tsukasa Setoguchi <[email protected]> Co-authored-by: Learnyst <[email protected]> Co-authored-by: IbrahimSulai <[email protected]> Co-authored-by: Benoit Dion <[email protected]> Co-authored-by: Mohammed Salman <[email protected]> Co-authored-by: Michael Tintiuc <[email protected]> Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <[email protected]> Co-authored-by: Benoit Dion <[email protected]> Co-authored-by: Di Da <[email protected]> Co-authored-by: Brandon Faulkner <[email protected]> Co-authored-by: Marlon Andrade <[email protected]> Co-authored-by: Hampton Maxwell <[email protected]> Co-authored-by: Harrison Mendonça <[email protected]> Co-authored-by: Evan Bacon <[email protected]> Co-authored-by: Param Aggarwal <[email protected]> Co-authored-by: anubansal <[email protected]> Co-authored-by: Sivakumar J <[email protected]> Co-authored-by: parikshit <[email protected]> Co-authored-by: anubansal92 <[email protected]> Co-authored-by: Rishu Agrawal <[email protected]> Co-authored-by: rishu-curefit <[email protected]> Co-authored-by: Tuan Luong <[email protected]> Co-authored-by: limaAniceto <[email protected]> Co-authored-by: Anders Lemke <[email protected]> Co-authored-by: Anton Tanderup <[email protected]> Co-authored-by: Jeferson Daniel <[email protected]> Co-authored-by: Daniel Mariño <[email protected]> Co-authored-by: Hampton Maxwell <[email protected]> Co-authored-by: Nick Fujita <[email protected]> Co-authored-by: redspear <[email protected]> Co-authored-by: Adam Gorman <[email protected]> Co-authored-by: Irwin <[email protected]> Co-authored-by: Radek Czemerys <[email protected]> Co-authored-by: Tero Paananen <[email protected]> Co-authored-by: Cameron Perry <[email protected]> Co-authored-by: Alexander Sklar <[email protected]> Co-authored-by: Sean Holbert <[email protected]> Co-authored-by: Jon Thysell <[email protected]> Co-authored-by: Milan Susnjar <[email protected]> Co-authored-by: Armands Malejev <[email protected]> Co-authored-by: Jonas Dalesjö <[email protected]> Co-authored-by: Shane Mckenna <[email protected]> Co-authored-by: Renaud Chaput <[email protected]> Co-authored-by: olivier bouillet <[email protected]> Co-authored-by: Omar Diop <[email protected]> Co-authored-by: Olivier Bouillet <[email protected]> Co-authored-by: ARTSOFT\csillaj <[email protected]>
When using same player for reproducing videos with different sizes and aspect ratios, exoplayer will not update aspect ratio layout upon source change
This changes fix this by invalidating the aspect ration on every source change so the layout will be recalculated on next
onVideoSizeChanged
event.Fixes #1225