<commit_before>#!/usr/bin/env ruby
require 'azure_media_service'

# initialize
AzureMediaService.configure do |config|
  # Media Service Account Name
  config.id = 'wiprolimited'
  # Media Service Access Key
  config.secret = 'robpEX8IQjir0wZEcFGo+Xp+H2GhazBTa9te3yM8+RQ='
end

# Test files located at
# => http://download.wavetlan.com/SVV/Media/HTTP/http-mp4.htm

# Download test file in sample directory
# wget http://download.wavetlan.com/SVV/Media/HTTP/H264/Talkinghead_Media/H264_test3_Talkingheadclipped_mp4_480x360.mp4

# If missing wget, brew install wget.
# To install brew: http://brew.sh/

media_file_name = 'H264_test3_Talkingheadclipped_mp4_480x360.mp4'

# Upload file
asset = AzureMediaService::Asset.create('dynamic_packaging')
asset.upload(media_file_name)
job = asset.encode_job('H264 Broadband 1080p')
@request = AzureMediaService.request
while true
  res = @request.get('Jobs')
  state = res['d']['results'].find{|entry| entry['Id'] == job['Id'] }['State']
  p [Time.now, state]
  break if state == 3
end

# Create OnDemand Locator
p job.output_assets.first.publish

# Print Publish URL
p job.output_assets.first.publish_url<commit_msg>Added support for HLS, DASH and Smooth.<commit_after>#!/usr/bin/env ruby
require 'azure_media_service'

# initialize
AzureMediaService.configure do |config|
  # Media Service Account Name
  config.id = 'wiprolimited'
  # Media Service Access Key
  config.secret = 'robpEX8IQjir0wZEcFGo+Xp+H2GhazBTa9te3yM8+RQ='
end

# Test files located at
# => http://download.wavetlan.com/SVV/Media/HTTP/http-mp4.htm

# Download test file in sample directory
# wget http://download.wavetlan.com/SVV/Media/HTTP/H264/Talkinghead_Media/H264_test3_Talkingheadclipped_mp4_480x360.mp4

# If missing wget, brew install wget.
# To install brew: http://brew.sh/

media_file_name = 'H264_test3_Talkingheadclipped_mp4_480x360.mp4'

# Upload file
asset = AzureMediaService::Asset.create('dynamic_packaging')
asset.upload(media_file_name)
job = asset.encode_job('H264 Broadband 1080p')
@request = AzureMediaService.request
while true
  res = @request.get('Jobs')
  state = res['d']['results'].find{|entry| entry['Id'] == job['Id'] }['State']
  p [Time.now, state]
  break if state == 3
end

# Create OnDemand Locator
p job.output_assets.first.publish
manifest = job.output_assets.first.publish_url

# Print Smooth Publish URL
smooth_url = manifest

# Print HLS Publish URL
hls_url = manifest + "(format=m3u8-aapl)"

# Print DASH Publish URL
dash_url = manifest + "(format=mpd-time-csf)"

puts "Smooth URL: #{smooth_url}"
puts "HLS URL: #{hls_url}"
puts "DASH URL: #{dash_url}"
{'fraction_non_alphanumeric': 0.12408759124087591, 'fraction_numerical': 0.033038801383019595, 'mean_word_length': 5.461538461538462, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3679598', 'n_tokens_mistral': 1013, 'n_tokens_neox': 949, 'n_words': 202}