Closed jgongo closed 4 years ago
I cannot reproduce this. Can you post some logs from when it happens? Does the video still play and is the app still responsive? Does the issue resolve after another seek? Does the issue happen with any asset, which asset did you test with? Does the issue still persist with ABR disabled?
I have moved my tests to a device (iPhone X) and the problem seems to persist. After seeking the audio stopped playing, and it was noticeable just a moment just before the video ended.
I didn't try to seek again, as I was using my own test app, I still have no controls implemented, and the seek was fired programatically with a timer.
The issue happens at least with the provided sample asset Angel One (URL included in code).
How do I disable ABR?
Here you have the code:
import UIKit
import ShakaPlayerEmbedded
class ViewController: UIViewController, ShakaPlayerClient {
private var player: ShakaPlayerView!
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Make a Shaka Player view.
player = ShakaPlayerView()
player.setClient(self)
player.logLevel = .V1
player.frame = self.view.bounds
self.view.addSubview(player)
// Load and play an asset.
let assetURL = "https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd"
player.load(assetURL, withStartTime: 0) { error in
if let error = error {
NSLog("Error loading resource: \(String(describing: error.message))")
} else {
NSLog("Resource correctly loaded")
}
self.player.play()
}
// SEEK
DispatchQueue.main.asyncAfter(deadline: .now() + 15) {
self.player.currentTime = 1
}
}
func onPlayerError(_ error: ShakaPlayerError!) {
NSLog("Error while playing: %@", error.message)
}
func onPlayerBufferingChange(_ is_buffering: Bool) {
NSLog("Buffering changed: \(is_buffering)")
}
func onPlayerPlayingEvent() {
NSLog("Player is playing, duration: \(player.duration)")
NSLog("Seek range: \(player.seekRange.start) -> \(player.seekRange.end)")
}
func onPlayerPauseEvent() {
NSLog("Player is paused")
}
func onPlayerEndedEvent() {
NSLog("Player ended")
}
func onPlayerSeekingEvent() {
NSLog("Player seeking started")
}
func onPlayerSeekedEvent() {
NSLog("Player seeking ended")
}
}
Ok, I seem to have found a pattern using the sample app:
This seems to happen quite consistently with Angel One, although some times seeking again fixes it.
I've also found it to happen consistently with Sintel 4k (multi codec) or Tears of Steel (multicodec, TTML) with the following behavior:
Ok, so it seems to be a problem with stream switching.
You can disable ABR the same was as with the JavaScript Shaka Player (google/shaka-player). See their tutorial and the argument documentation. You can only use the string form of configure
. You would do it with:
player.configure("abr.enabled", withBool: false);
I just pushed a change that fixes sometimes when the audio doesn't play. Please try again with the latest master
.
This seems to be working now. Thanks!!
After successfully running the sample app in the simulator I browsed some of the sample assets and noticed that from time to time, after seeking backward or forward, audio would randomly stop playing (not always, but easily reproducible if you move the slider a few times).