lepips / vlcui Goto Github PK
View Code? Open in Web Editor NEWVLCKit for SwiftUI
License: MIT License
VLCKit for SwiftUI
License: MIT License
VLCMediaPlayer
has many additional properties.
Provide properties in:
Configuration
for defaultsEvent
for customizationPlaybackInformation
for live informationTransforms on macOS require additional handling for scaling, where the anchor point of the layer must be updated along with the scaling.
Resources:
EDIT : Doesn't matter. Found a different solution.
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.
I've encountered this button on both tvOS and iOS with Swiftfin, and i'm incredibly confused as to what it means.
I assume it means autoplay? If so, please use a more specific icon for it (such as repeat.circle
and repeat.circle.fill
), since pressing it doesn't do anything but toggling it, and there's no indication of what it's supposed to do.
Hi,
I'm trying to add a fullscreen toggle for my player but the problem is that it currently seems to be impossible to re-render the view without resetting the VLCMediaPlayer
.
This is because the VLCVideoPlayer
always creates a new UIVLCVideoPlayerView
view:
public struct VLCVideoPlayer: _PlatformRepresentable {
private var configuration: VLCVideoPlayer.Configuration
private var proxy: VLCVideoPlayer.Proxy?
private var onTicksUpdated: (Int, VLCVideoPlayer.PlaybackInformation) -> Void
private var onStateUpdated: (VLCVideoPlayer.State, VLCVideoPlayer.PlaybackInformation) -> Void
private var loggingInfo: (VLCVideoPlayerLogger, LoggingLevel)?
#if os(macOS)
public func makeNSView(context: Context) -> UIVLCVideoPlayerView {
makeVideoPlayerView()
}
public func updateNSView(_ nsView: UIVLCVideoPlayerView, context: Context) {}
#else
public func makeUIView(context: Context) -> UIVLCVideoPlayerView {
makeVideoPlayerView()
}
public func updateUIView(_ uiView: UIVLCVideoPlayerView, context: Context) {}
#endif
private func makeVideoPlayerView() -> UIVLCVideoPlayerView {
UIVLCVideoPlayerView(
configuration: configuration,
proxy: proxy,
onTicksUpdated: onTicksUpdated,
onStateUpdated: onStateUpdated,
loggingInfo: loggingInfo
)
}
}
which in turn always creates a new VLCMediaPlayer
:
init(
configuration: VLCVideoPlayer.Configuration,
proxy: VLCVideoPlayer.Proxy?,
onTicksUpdated: @escaping (Int, VLCVideoPlayer.PlaybackInformation) -> Void,
onStateUpdated: @escaping (VLCVideoPlayer.State, VLCVideoPlayer.PlaybackInformation) -> Void,
loggingInfo: (VLCVideoPlayerLogger, VLCVideoPlayer.LoggingLevel)?
) {
self.configuration = configuration
self.proxy = proxy
self.onTicksUpdated = onTicksUpdated
self.onStateUpdated = onStateUpdated
self.loggingInfo = loggingInfo
super.init(frame: .zero)
proxy?.videoPlayerView = self
#if os(macOS)
layer?.backgroundColor = .clear
#else
backgroundColor = .clear
#endif
setupVideoContentView()
setupVLCMediaPlayer(with: configuration)
}
func setupVLCMediaPlayer(with newConfiguration: VLCVideoPlayer.Configuration) {
currentMediaPlayer?.stop()
currentMediaPlayer = nil
let media = VLCMedia(url: newConfiguration.url)
media.addOptions(newConfiguration.options)
let newMediaPlayer = VLCMediaPlayer()
newMediaPlayer.media = media
newMediaPlayer.drawable = videoContentView
newMediaPlayer.delegate = self
if let loggingInfo = loggingInfo {
newMediaPlayer.libraryInstance.debugLogging = true
newMediaPlayer.libraryInstance.debugLoggingLevel = loggingInfo.level.rawValue.asInt32
newMediaPlayer.libraryInstance.debugLoggingTarget = self
}
for child in newConfiguration.playbackChildren {
newMediaPlayer.addPlaybackSlave(child.url, type: child.type.asVLCSlaveType, enforce: child.enforce)
}
configuration = newConfiguration
currentMediaPlayer = newMediaPlayer
proxy?.mediaPlayer = newMediaPlayer
hasSetCurrentConfigurationValues = false
lastPlayerTicks = 0
lastPlayerState = .opening
if newConfiguration.autoPlay {
newMediaPlayer.play()
}
}
Would it be possible to change this behaviour to work more like SwiftUI's video player, which creates a new VideoPlayer view that references an existing AVPlayer? This would make implementing such use cases a lot more convenient.
hello
setAudioTrack function not working because it triggers the function to change subtitles
Proxy.swift line number 76
plaese replace currentVideoSubTitleIndex with currentAudioTrackIndex
Hi,
Using: tvOSVLCUI example
I can play the videos fine but when i press play/pause it doesnt update viewModel.playerState in OverlayView, the others one like viewModel.position does, but not playerState.
Hi,
I am having difficulty loading images for forever duration. I can load images fine with
viewModel.proxy.playNewMedia(VLCVideoPlayer.Configuration( url: URL(string: "https://cdn.mos.cms.futurecdn.net/AT9Bcvo94cTMGmESvL4JCK.jpg")!))
It only seems to last like a second or so, and then i get a stopped event.
When windows are resized/rotated on macOS/iOS, respect current percentage of aspect fill.
Currently, VLCVideoPlayer.Event.aspectFill
animation is manually controlled.
Replace to be more customizable by removing the manual animation and replace with:
enum Event {
/// Aspect fill given the percentage between 0...1.0
case aspectFill(Float)
}
This would set the aspect fill state to a certain progress. This would allow gestures to set the aspect fill based on its percentage completed and the send event can be surrounded by an animation for animations.
Thanks for making this, it's great.
One thing I think is missing, and I don't know if you intend to add it or not, is to be able to Swipe Up/Down/Left/Right to display some sort of view.
For example, Swipe Down to show an information panel about the currently playing video. fully interactive panel so you can change settings etc. Just the mechanics to display the panel would be ideal. how it looks down to the developer. Thanks
When using jumpFoward/jumpBackward
with a length that would put VLCMediaPlayer
out of bounds of the media it puts it into an untrackable state. Check when using these events against the ticks/seconds to put VLCVideoPlayer
into a custom and friendly state.
For replay
the current configuration is used but with the start ticks set to 0 and auto play enabled. The configuration contextually represents the values of how the current media started.
Add an additional alteredConfiguration
property that has the current player-state values like subtitle index, playback children, etc. and is rotated to that configuration on replay.
Add VLCVideoPlayer.Event.advanceNextFrame
which calls VLCMediaPlayer.gotoNextFrame()
along with documentation that it will stop playback and put it into a certain state.
Currently, stats from VLCMedia
are provided at VLCVideoPlayer.PlaybackInformation.stats
. Remove this dictionary and replace with corresponding properties.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.