Generate all the files (.vtt + sprite) for the Tooltip Thumbnails options of Jwplayer

后端 未结 5 1584
闹比i
闹比i 2020-12-28 20:53

What is the best way to generate the \".VTT\" file and the jpg sprite attached with it for the Tooltip Thumbnails of Jwplayer (http://www.jwplayer.com/blog/

5条回答
  •  难免孤独
    2020-12-28 21:16

    I've developed a Ruby gem to easily create .VTT file and sprite of thumbnails.

    Thanks for inspiring @randalv!

    You can take a look at it here: https://github.com/scaryguy/jwthumbs


    Usage

    Instantiate your video file:

    movie = Jwthumbs::Movie.new("YOUR_VIDEO.mp4")
    

    Jwthumbs::Movie.new accepts second parameter as a options hash. You can configure several stuff at the same time you instantiate your video like this:

    movie = Jwthumbs::Movie.new("YOUR_VIDEO.mp4", seconds_between: 60, sprite_name: "my_sprite_name.jpg")
    

    or after you instentiated your video, you can use Jwthumbs::Movie file to configure things:

    movie = Jwthumbs::Movie.new("YOUR_VIDEO.mp4")
    movie.seconds_between = 60
    movie.sprite_name = "my_sprite_name.jpg"
    

    and then to create your thumbnails and .VTT file just run this command.

    movie.create_thumbs!
    

提交回复
热议问题