Skip to content

iOS playback failed #40

Closed
Closed

Description

@tudosxxx

Some logs printed from URLs end in .bin when saved on the phone, and some end in .mp4. If the log ends in .bin, it cannot be played.

Activity

  1. tudosxxx commented on Aug 8, 2024

    @tudosxxx
    Author

    flutter: Cached video of [https://cdn.xxxx.top/SocialFit/post/SnapVid.Net_3241856401650611273.mp4] is: /var/mobile/Containers/Data/Application/DB92663F-B5FA-4A42-A254-F970651F9D08/Library/Caches/libCachedVideoPlayerPlusData/b93e1750-5555-11ef-9065-0bc8c40944f8.mp4

    flutter: Cached video of [https://cdn.fxxxxx.top/SocialFit/post/1723092727753_15116.mp4] is: /var/mobile/Containers/Data/Application/DB92663F-B5FA-4A42-A254-F970651F9D08/Library/Caches/libCachedVideoPlayerPlusData/af07f490-5555-11ef-9065-0bc8c40944f8.bin

  2. OutdatedGuy commented on Aug 9, 2024

    @OutdatedGuy
    Owner

    Are only selected urls being cached as .bin files or any file is cached as .bin?

    Also can you just try with the video_player plugin and see if all your urls work properly there?

  3. hasuwebforest commented on Aug 23, 2024

    @hasuwebforest

    i am also getting url end with c8c40944f8.bin in ios real device, in android working fine. while caching video its save with c8c40944f8.bin. can you help me out why is it happend?

  4. OutdatedGuy commented on Sep 16, 2024

    @OutdatedGuy
    Owner

    @hasuwebforest Can you try with video_player as mentioned in this comment.

  5. chahohbily commented on Sep 21, 2024

    @chahohbily

    @OutdatedGuy Same problem here, only IOS files caches with .bin enviroment. Furthermore, I added the code below where it expects the video to be downloaded from the network when the .bin file is received and it also doesn't work, no download from the network.

    if (cachedFile!.file.path.contains('.bin')){
            isCacheAvailable = false;
          }
    
          realDataSource = isCacheAvailable
              ? Uri.file(cachedFile.file.path).toString()
              : dataSource;
    

    With a normal video_player everything works stably!!!

  6. Oliver-WJ commented on Oct 30, 2024

    @Oliver-WJ

    This can solve your problem:
    dependency_overrides:
    flutter_cache_manager:
    git:
    url: https://github.com/Oliver-WJ/flutter_cache_manager.git
    path: flutter_cache_manager

  7. added this to the v4.0.0 milestone on Nov 27, 2024
  8. Musaddiq625 commented on Dec 5, 2024

    @Musaddiq625
  9. guneyozsan commented on Jan 9, 2025

    @guneyozsan

    I checked the flutter_cache_manager code and it is setting the file extension using the contentType header. I don't think there is much to do if you don't have control of the server. We are trying to fix the issue on server side and I'll report back the result when done.

    If you need the details, I left a comment on the relevant issue in flutter_cache_manager repo:

  10. guneyozsan commented on Feb 24, 2025

    @guneyozsan

    We fixed this by setting the header on the server as video/mp4.

  11. OutdatedGuy commented on Jul 8, 2025

    @OutdatedGuy
    Owner

    It appears the root of this issue lies within the flutter_cache_manager package, which is beyond my direct control to fix.

    If you're encountering this problem, here are two potential workarounds:

    1. If you own the content server

    You can resolve this by configuring your server to correctly set the Content-Type header in its responses. This header is crucial for determining the file extension. For more details, refer to these comments: comment 1 and comment 2.

    2. If you don't own or cannot configure the content server

    You can override the flutter_cache_manager dependency to use a community-contributed fix. Add the following to your pubspec.yaml file:

    dependencies:
      cached_video_player_plus: ^3.0.3
    
    dependency_overrides:
      flutter_cache_manager:
        git:
          url: https://github.com/Oliver-WJ/flutter_cache_manager.git
          path: flutter_cache_manager

    While these workarounds don't guarantee a 100% fix, they should significantly mitigate the issue until a proper solution is implemented in the underlying package.

  12. added
    help wantedExtra attention is needed
    and removed
    questionFurther information is requested
    on Jul 8, 2025
  13. removed this from the v4.0.0 milestone on Jul 9, 2025
  14. added
    bugSomething isn't working correctly
    and removed
    help wantedExtra attention is needed
    on Jul 15, 2025
  15. AliAzizi commented on Sep 23, 2025

    @AliAzizi

    @OutdatedGuy There are exposed methods and getters inside flutter_cache_manager where I think you can define a simple extension method and override its behavior to preserve the file extension.
    The only part that needs to be simulated (based on how this library works) is managing the CacheObject

    Here is a similar extension method (though it’s not ideal in this case, as it renames the file after it has already been saved with a .bin extension). It should at least give the idea:
    Baseflow/flutter_cache_manager#405 (comment)

    I didn’t have time to fully explore how the default download method creates the CacheObject, but I believe it’s possible to mock that and save it with the correct extension directly.

    This way, there’s no need to use a dependency override anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working correctlyupstream: flutter_cache_managerCaused by flutter_cache_manager. Please report upstream.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions