Skip to content

DefaultTimeBar doesn't show the progress #3926

@prilaga

Description

@prilaga

Hi, I have purpose to play video from different sources. From network (DASH) I see the progress of seekbar, but when the source is a file - not.
It happened on every time if I try to play from file. I tried different mp4 files.

Seems problem that player can't detect the total length of the video.
How to resolve this issue?

exoplayer v.2.7.0
sony z5, android 7.1.1

any video file can be used, just replace "file_path" with real path.

video for testing: https://www.dropbox.com/s/3y7w8c0e5j1aukt/17900053588159454.mp4?dl=0

code:

            val bandwidthMeter = DefaultBandwidthMeter()

            val videoTrackSelectionFactory = AdaptiveTrackSelection.Factory(bandwidthMeter)
            val trackSelector = DefaultTrackSelector(videoTrackSelectionFactory)
            val player = ExoPlayerFactory.newSimpleInstance(this, trackSelector)

            binding.exoPlayer.player = player
            player.playWhenReady = true

            val videoFile = File("file_path")
            val uri = Uri.fromFile(videoFile)
            val dataSpec = DataSpec(uri)
            val fileDataSource = FileDataSource(bandwidthMeter)
            fileDataSource.open(dataSpec)
            val factory: DataSource.Factory = DataSource.Factory { fileDataSource }
            val mediaSource = ExtractorMediaSource.Factory(factory).createMediaSource(fileDataSource.uri, Handler(), null)
            player.prepare(mediaSource)

On the left side - progress time, on the right - total time.
device-2018-03-02-133550

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions