-
-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// MEPlayerViewController.swift | ||
// demo-iOS | ||
// | ||
// Created by kintan on 2023/10/9. | ||
// Copyright © 2023 kintan. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import KSPlayer | ||
class MEPlayerViewController: UIViewController { | ||
private var player: MediaPlayerProtocol! | ||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
let definition = testObjects[0].definitions[0] | ||
player = KSMEPlayer(url: definition.url, options: definition.options) | ||
player.delegate = self | ||
player.view?.autoresizingMask = [.flexibleWidth, .flexibleHeight] | ||
player.view?.frame = view.bounds | ||
player.contentMode = .scaleAspectFill | ||
player.prepareToPlay() | ||
view.addSubview(player.view!) | ||
} | ||
} | ||
|
||
extension MEPlayerViewController: MediaPlayerDelegate { | ||
func readyToPlay(player: some KSPlayer.MediaPlayerProtocol) { | ||
player.play() | ||
} | ||
|
||
func changeLoadState(player _: some KSPlayer.MediaPlayerProtocol) {} | ||
|
||
func changeBuffering(player _: some KSPlayer.MediaPlayerProtocol, progress _: Int) {} | ||
|
||
func playBack(player _: some KSPlayer.MediaPlayerProtocol, loopCount _: Int) {} | ||
|
||
func finish(player _: some KSPlayer.MediaPlayerProtocol, error _: Error?) {} | ||
} |