question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to set start position for audio and video elements

See original GitHub issue

See: https://discuss.streamlit.io/t/feature-request-provide-start-position-for-playback-in-the-audio-player/343

Proposed API:

st.audio(data, format="audio/wav", start_time=0)
st.video(data, format="video/mp4", start_time=0)

The reason start_time goes at the end is because it’s less likely people will want to set that arg than the format arg.

There was also some discussion about calling it “current_time” vs. “start_time”, but we decided on the latter because “current_time” just sounds confusing in this context. Sure we’re using the HTML currentTime property under the hood —but while that name makes sense as a dynamic property you can read/write in JS, it does not make sense as a static property that you only set once.

API status: ready to implement

The MDN entry for <audio> element shows you can easily do this by setting the currentTime attribute.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mrunderlinecommented, Oct 12, 2019

I read updated issue body and your new comment on the PR. While developing, I was thinking like you, but the issue body was different so I respect it. But finally it’s OK and I’ll do them.

0reactions
nthmostcommented, Oct 22, 2019

Merged into develop, so closing as complete. Thanks @mrunderline !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting HTML5 audio position - Stack Overflow
To jump around an audio file, your server must be configured properly. The client sends byte range requests to seek and play certain...
Read more >
The Embed Audio element - HTML - MDN Web Docs - Mozilla
To get a consistent look and feel across browsers, you'll need to create custom controls; these can be marked up and styled in...
Read more >
Position targeting - Display & Video 360 Help
Position targeting allows you to control where your ads will appear relative to other content, whether it's text on a webpage or within...
Read more >
10 Advanced Features In The HTML5 <video> Player
Specifying multiple sources for a video; Showing or hiding the video player's controls; Start or stop the video at a certain point or...
Read more >
4.8.6 The video element — HTML5 - W3C
The src , preload , autoplay , loop , and controls attributes are the attributes common to all media elements. The audio attribute...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found