Skip to content
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

Playing local files #22

Open
explaineverything opened this issue May 26, 2018 · 4 comments
Open

Playing local files #22

explaineverything opened this issue May 26, 2018 · 4 comments

Comments

@explaineverything
Copy link

I have a question. Does this player plays also local files (on iPad/iPhone) or only by http streaming? Thanks in response.

@DeviLeo
Copy link
Owner

DeviLeo commented May 28, 2018

Both local files and http streaming.

@explaineverything
Copy link
Author

explaineverything commented May 28, 2018

Thanks.
Maybe I am doing something wrong, but I cannot start playing video. I am running Example and in DLGPlayerViewController in viewDidLoad method I added:

    vc.autoplay = YES;
    vc.repeat = YES;
    vc.preventFromScreenLock = YES;
    vc.restorePlayAfterAppEnterForeground = YES;
    vc.view.frame = self.view.frame;
    [self.view addSubview:vc.view];

    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"mp4"];
    NSLog(@"File exists: %@", @([NSFileManager.defaultManager fileExistsAtPath:filePath]));
    vc.url = filePath;
    [vc open];

    self.playerViewController = vc;

I have the following logs:

2018-05-28 10:32:46.495011+0200 DLGPlayer[5197:2841081] Metal GPU Frame Capture Enabled
2018-05-28 10:32:46.496260+0200 DLGPlayer[5197:2841081] Metal API Validation Enabled
2018-05-28 10:32:46.557246+0200 DLGPlayer[5197:2841081] File exists: 1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/containers/Bundle/Application/BDC1588E-6C46-4BC8-B7E6-338A0E536D5B/DLGPlayer.app/test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp41mp42isom
    creation_time   : 2015-03-06T12:01:02.000000Z
  Duration: 00:00:15.00, bitrate: N/A
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 1024x768, 119 kb/s, 30 fps, 30 tbr, 600 tbn (default)
    Metadata:
      creation_time   : 2015-03-06T12:01:02.000000Z
      handler_name    : Core Media Video
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, 2 channels, 249 kb/s (default)
    Metadata:
      creation_time   : 2015-03-06T12:01:02.000000Z
      handler_name    : Core Media Audio
2018-05-28 10:33:00.003669+0200 DLGPlayer[5197:2841081] Status bar could not find cached time string image. Rendering in-process.

The video does not play, scrolling also doesn't work. Only black screen with empty bar is visible.
Thanks for help.

@DeviLeo
Copy link
Owner

DeviLeo commented May 28, 2018

I suggest you open the media in viewDidAppear.
If you insist viewDidLoad, do the following changes in DLGPlayerViewController.m.

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self initAll];
    [self registerNotification]; // <-- Move from viewWillAppear:
}

// Unregister notifications when dealloc
- (void)dealloc {
    [self unregisterNotification];  // <-- Move from viewWillDisappear:
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    // [self registerNotification]; // <-- Delete
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    // [self unregisterNotification]; // <-- Delete
}

@explaineverything
Copy link
Author

Ok Thanks @DeviLeo!!!
It works from viewDidApper: method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant