LePips / VLCUI

VLCKit for SwiftUI
MIT License
38 stars 17 forks source link

Using demo and double playback issue #14

Closed UnknownCoder807 closed 1 year ago

UnknownCoder807 commented 1 year ago

I am testing your great library out and just looking at the Example app you provide.

I am using tvOS

I noticed that when the app starts, big buck bunny starts to play, then after around 0.2 seconds, it restarts playing again from the beginning.

Is this intentional?

To test out commands, I tried to seek to a starting position of 0.75 (ie, three quarters of the way through) but because of this double playback issue, it's not possible. The first 0.2 seconds of the video has seeked to the required position, but the 2nd start ignores it and starts from 0.

LePips commented 1 year ago

This appears to be an issue with VLCKit that only appears when starting media from the very beginning. I verified that the media player is only being set once, which is what could possibly cause this issue on my end.

To test out commands, I tried to seek to a starting position of 0.75

By this comment I assume that you are trying to:

1 - send a command through the proxy right after playing 2 - use a unit value of 0.75 to get 75% through the media's length

For 1, set the start time using the configuration startTime property instead. The blanking does not seem to happen when having an offset start time. From the example project:

var configuration: VLCVideoPlayer.Configuration {
    let configuration = VLCVideoPlayer
        .Configuration(url: URL(string: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4")!)
    configuration.autoPlay = true
    configuration.startTime = .seconds(5) // start 5 seconds in
    return configuration
}

For 2, you must use either seconds or ticks. If you are putting a value of 0.75 seconds/ticks it will round down to 0, so your results make sense.

UnknownCoder807 commented 1 year ago

Thanks. The configuration.startTime fixes the problem for video files, but for live tv streams (.ts format) there is still the problem. I realise it's a live tv channel and you can't seek 5 seconds. Is there a way to apply a buffer of say 1 second to the configuration? maybe that will help.

UnknownCoder807 commented 1 year ago

Also, I am just looking over the library. At the moment i use VLCVideoPlayer(url: url) to to play a video which is dynamic and passed to the url variable at run time. Is it possible to set the configuration options like startTime at this stage too? rather than the hardcoded way in the viewModel ?

Sorry if this is basic, but I'm learning swiftui and your library/vlckit as I go.

LePips commented 1 year ago

I'm sorry, but I can't provide anything regarding playback with VLCKit, this project is just a wrapper. At least in my experience, live streams aren't entirely the best but also a slight flicker isn't the end of the world.

The VLCVideoPlayer object has a few initializers that you can use. You can set the start time when you create the config however you would like, don't focus on the "hardcoded" part.