Giter Site home page Giter Site logo

Comments (3)

icbaker avatar icbaker commented on May 22, 2024

However, this approach is not viable for us, since we're fetching the stream links dynamically (more on that here). So the url in MediaItem is not yet a valid one (it contains just information to fetch the link, smth like app://play?media_id=1). The actual url is fetched using ResolvingDataSource.

Previously we were sending an additional field in our media responses from the backend that contained the available transport methods (HLS, DASH etc). Based on that, we were creating a correspondent MediaSourceFactory on the fly (that MediaSourceFactory was created with ResolvingDataSource). However, this seems to be a sort of hack that we'd like to avoid to make our app more scalable (not to mention that this does not fit into media3 architecture at all)

Possibly obvious question: Given the original 'dynamic' URL do you know whether it will resolve to a DASH or HLS URL? If you do know that in advance then you can just use MediaItem.Builder#setMimeType and everything should just work (this will override any inference done from the URL ending).

Otherwise it sounds like you're looking for a 'do everything' MediaSource. We don't currently have one of those - though there is a draft DefaultMediaSource in a commit linked from google/ExoPlayer#3165 (comment) which you may find useful as inspiration (I haven't compared it in detail to what you've posted).

from media.

NikSatyr avatar NikSatyr commented on May 22, 2024

Thanks for a quick reply.

Regarding dynamic URL: yes, we could include stream type there & then set up mime type, but that's exactly what we'd like to avoid :)

As for the draft commit you provided – this looks kinda promising. I'll take a deeper dive & get back to you

from media.

NikSatyr avatar NikSatyr commented on May 22, 2024

I've dug into the example you provided and it's pretty much the same with what I've come up with. Thanks!

from media.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.