Code Monkey home page Code Monkey logo

m3u8's People

Contributors

dakaz avatar elsurudo avatar jviney avatar raphi avatar rmberg avatar sethdeckard avatar takashisite avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

m3u8's Issues

get segment from TimeItem

Hello,
I've tried parsing my file

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:1582061
#EXTINF:10, no desc
#EXT-X-PROGRAM-DATE-TIME:2016-01-01T18:22:09Z
20160321T150304_2_5560256_1582061.ts
#EXTINF:10, no desc
#EXT-X-PROGRAM-DATE-TIME:2016-01-01T18:22:19Z
20160321T150304_2_5560256_1582062.ts

I get a list of TimeItem which makes sens, but how can I get the filename (.ts) ? Does this lib support this format?
thanks

M3u8::Playlist.read("path/to/file") fails silently

Had a few minutes of head scratching when I tried calling M3u8::Playlist.read with a path before I realized I needed an IO object. Calling read with a path doesn't throw an error and returns a playlist regardless

irb(main):002:0> M3u8::Playlist.read("~/Desktop/long_hls")
=> #<M3u8::Playlist:0x007fb77388de20 @version=nil, @sequence=0, @cache=nil, @target=10, @type=nil, @iframes_only=false, @independent_segments=false, @items=[]>

Request/bug: Support iTunes' m3u8 files

Such as the files that iTunes outputs when exporting playlists.

It's understandable (and clearly necessary) to have a library that handles HLS m3u8 files, it would just also be nice to import these other standard files.

Feature request: Type conversion from M3u8::Playlist to M3u8::PlaylistItem

Recently I had a use case where I was looking to convert a M3u8::Playlist to M3u8::PlaylistItem. I was a bit surprised it's not supported by this gem, and that PlaylistItem instances need to be built from an options hash. This doesn't seem like a rare use case, especially when working with a master playlists, parsing media playlists they contain, working with them, and building a new master playlist as a result.

Here's a short example use case I'm imagining:

my_file = File.open('spec/fixtures/media_playlist-664.m3u8')
media_playlist = M3u8::Playlist.read(my_file)
playlist_item = M3u8::PlaylistItem.new(media_playlist)

My temporary workaround for this is to dump all of a Playlist's instance variables into a hash (excluding items, etc.) and building a new PlaylistItem from that. If there's a more intuitive way to do this that I'm missing, please let me know.

A secondary solution could be to implement a Playlist#to_options method that returns an options hash that allows for easy creation of a PlaylistItem:

my_file = File.open('spec/fixtures/media_playlist-664.m3u8')
media_playlist = M3u8::Playlist.read(my_file)
playlist_item = M3u8::PlaylistItem.new(media_playlist.to_options)

If you are on board with the feature request, I'll be happy to write the specs and open a PR.

Thanks!

Elegant way to find items by criteria

Thanks for making this library!

Is there a built-in search feature, ie. find the item with the best video resolution? Or at least a less clunky way than:

item = m3u8.items.max_by { |e| (e.respond_to?(:height) && e.height) || 0 }

Wouldn't it be simpler and better if the object returned was a symbol hash rather than an object with methods?

#EXT-X-PROGRAM-DATE-TIME missing?

date = "#{program_date_time}\n" unless program_date_time.nil?

It looks like when this gets rendered it's missing the #EXT-X-PROGRAM-DATE-TIME, only rendering the time. I'm not sure if this was an intentional design decision or a bug? It looks like it's been in there for 5 years if it is a bug, so wanted to make sure before working on a PR.

Details:

...
playlist.items << M3u8::SegmentItem.new(program_date_time: Time.now, duration: 10, segment: 'http://example.com/segment-1.aac')
....

Expected:

#EXTINF:9.770667,
#EXT-X-PROGRAM-DATE-TIME: 2020-11-25 14:27:00 -0600
http://example.com/segment-1.aac

Actual:

#EXTINF:9.770667,
2020-11-25 14:27:00 -0600
http://example.com/segment-1.aac

the latter seems to cause players to try and request "2020-11-25 14:27:00 -0600" as a fragment url.

I worked around the issue for the timebeing by passing the "#EXT-X-PROGRAM-DATE-TIME: #{Time.now}", as the program_date_time attribute, which feels a little clunky unless I'm missing the reasoning for it being this way. Thoughts?

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.