mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
feat: support start time
This commit is contained in:
@@ -97,6 +97,7 @@ class VlcPlayerView: ExpoView {
|
||||
let initType = source["initType"] as? Int ?? 0
|
||||
let autoplay = source["autoplay"] as? Bool ?? false
|
||||
let isNetwork = source["isNetwork"] as? Bool ?? false
|
||||
let startPosition = source["startPosition"] as? Int32 ?? 0
|
||||
|
||||
guard let uri = uri, !uri.isEmpty else { return }
|
||||
|
||||
@@ -152,6 +153,10 @@ class VlcPlayerView: ExpoView {
|
||||
|
||||
self.mediaPlayer?.media = media
|
||||
|
||||
if startPosition > 0 {
|
||||
self.mediaPlayer?.time = VLCTime(int: startPosition)
|
||||
}
|
||||
|
||||
if autoplay {
|
||||
self.play()
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ export type VlcPlayerSource = {
|
||||
autoplay?: boolean;
|
||||
initOptions?: any[];
|
||||
mediaOptions?: { [key: string]: any };
|
||||
startPosition?: number;
|
||||
};
|
||||
|
||||
export type TrackInfo = {
|
||||
|
||||
@@ -101,6 +101,10 @@ const VlcPlayerView = React.forwardRef<VlcPlayerViewRef, VlcPlayerViewProps>(
|
||||
const processedSource: VlcPlayerSource =
|
||||
typeof source === "string" ? { uri: source } : source;
|
||||
|
||||
if (processedSource.startPosition !== undefined) {
|
||||
processedSource.startPosition = Math.floor(processedSource.startPosition);
|
||||
}
|
||||
|
||||
return (
|
||||
<NativeView
|
||||
{...otherProps}
|
||||
|
||||
Reference in New Issue
Block a user