Sha256: 3b28cf471ecb230b77a291a47e5ead8d26e4c989bf1f25e8010295f8cccb4279

Contents?: true

Size: 1.05 KB

Versions: 39

Compression:

Stored size: 1.05 KB

Contents

#!/usr/bin/env ruby

require 'mux_ruby'
require 'solid_assert'

SolidAssert.enable_assertions

# Authentication Setup
openapi = MuxRuby.configure do |config|
  config.username = ENV['MUX_TOKEN_ID']
  config.password = ENV['MUX_TOKEN_SECRET']
end

# API Client Initialization
assets_api = MuxRuby::AssetsApi.new

# Create an Asset
car = MuxRuby::CreateAssetRequest.new
car.input = 'https://storage.googleapis.com/muxdemofiles/mux-video-intro.mp4'
car.playback_policy = [MuxRuby::PlaybackPolicy::PUBLIC]
create_response = assets_api.create_asset(car)
puts "Created Asset ID: #{create_response.data.id}"

# Wait for the asset to become ready, then print its URL
if create_response.data.status != 'ready'
  puts "Waiting for asset to become ready..."
  while true do
    asset = assets_api.get_asset(create_response.data.id)
    if asset.data.status != 'ready'
      puts "Asset not ready yet, sleeping..."
      sleep(1)
    else
      puts "Asset ready! Playback URL: https://stream.mux.com/#{create_response.data.playback_ids.first.id}.m3u8"
      break
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
mux_ruby-3.20.0 examples/video/ingest.rb
mux_ruby-3.19.0 examples/video/ingest.rb
mux_ruby-3.18.0 examples/video/ingest.rb
mux_ruby-3.17.0 examples/video/ingest.rb
mux_ruby-3.15.0 examples/video/ingest.rb
mux_ruby-3.14.0 examples/video/ingest.rb
mux_ruby-3.13.0 examples/video/ingest.rb
mux_ruby-3.12.0 examples/video/ingest.rb
mux_ruby-3.11.1 examples/video/ingest.rb
mux_ruby-3.11.0 examples/video/ingest.rb
mux_ruby-3.9.0 examples/video/ingest.rb
mux_ruby-3.8.0 examples/video/ingest.rb
mux_ruby-3.7.0 examples/video/ingest.rb
mux_ruby-3.6.0 examples/video/ingest.rb
mux_ruby-3.5.2 examples/video/ingest.rb
mux_ruby-3.5.1 examples/video/ingest.rb
mux_ruby-3.5.0 examples/video/ingest.rb
mux_ruby-3.4.0 examples/video/ingest.rb
mux_ruby-3.3.1 examples/video/ingest.rb
mux_ruby-3.3.0 examples/video/ingest.rb