Developer-friendly & type-safe Ruby SDK for integrating with the FastPix Live Streaming API.
The FastPix Ruby SDK simplifies integration with the FastPix platform. This SDK is designed for secure and efficient communication with the FastPix API, enabling easy management of media uploads, live streaming, and simulcasting.
- Media API
- Upload media files seamlessly from URLs or devices
- Manage media: list, fetch, update, and delete media assets
- Generate and manage playback IDs for media access
- Live API
- Create, list, update, and delete live streams
- Generate playback IDs for live streams to control and manage access
- Simulcast to multiple platforms simultaneously
- Ruby 2.7 or later
- FastPix API credentials (Access Token and Secret Key)
To get started with the FastPix Ruby SDK, ensure you have the following:
- The FastPix APIs are authenticated using an Access Token and a Secret Key. You must generate these credentials to use the SDK.
- Follow the steps in the Authentication with Access Tokens guide to obtain your credentials.
- Installation
- Quick Start
- Authentication
- Available Resources & Operations
- Error Handling
- Server Selection
- Development
- Contributing
You can install the SDK using one of the following methods:
gem install specific_install
gem specific_install https://github.com/FastPix/fastpix-ruby.git
gem 'fastpixapi', git: 'https://github.com/FastPix/fastpix-ruby.git'
gem build fastpixapi.gemspec
gem install ./fastpixapi-0.0.1.gem
Once published, you can simply run:
gem install fastpixapi
Here's how to get started with the FastPix Ruby SDK:
require 'fastpixapi'
# Initialize the SDK with authentication
sdk = ::FastpixApiSDK::SDK.new(
security: Models::Components::Security.new(
username: 'your-username',
password: 'your-password'
)
)
# Create a new live stream
request = Models::Components::CreateLiveStreamRequest.new(
playback_settings: Models::Components::PlaybackSettings.new(),
input_media_settings: Models::Components::InputMediaSettings.new(
metadata: Models::Components::CreateLiveStreamRequestMetadata.new()
)
)
response = sdk.start_live_stream.create_new_stream(request)
if !response.live_stream_response_dto.nil?
puts "Stream created! ID: #{response.live_stream_response_dto.stream_id}"
end
The SDK uses HTTP Basic authentication. Set your credentials when initializing the SDK:
sdk = ::FastpixApiSDK::SDK.new(
security: Models::Components::Security.new(
username: 'your-username',
password: 'your-password'
)
)
- createMedia - Create media from URL
- directUploadVideoMedia - Upload media from device
- getAllStreams - Get all live streams
- getLiveStreamById - Get stream by ID
- deleteLiveStream - Delete a stream
- updateLiveStream - Update a stream
- listMedia - Get list of all media
- getMedia - Get a media by ID
- updatedMedia - Update a media by ID
- deleteMedia - Delete a media by ID
- retrieveMediaInputInfo - Get info of media inputs
- createPlaybackIdOfStream - Create a playbackId
- deletePlaybackIdOfStream - Delete a playbackId
- getLiveStreamPlaybackId - Get stream's playbackId
- createMediaPlaybackId - Create a playback ID
- deleteMediaPlaybackId - Delete a playback ID
- createSimulcastOfStream - Create a simulcast
- deleteSimulcastOfStream - Delete a simulcast
- getSpecificSimulcastOfStream - Get a specific simulcast of a stream
- updateSpecificSimulcastOfStream - Update a specific simulcast of a stream
- createNewStream - Create a new stream
streams = sdk.manage_live_stream.get_all_streams
streams.each do |stream|
puts "Stream ID: #{stream.id}, Status: #{stream.status}"
end
All operations return a response object or raise an error. For example:
begin
response = sdk.start_live_stream.create_new_stream(request)
rescue Models::Errors::UnauthorizedError => e
puts "Unauthorized: #{e.message}"
rescue Models::Errors::InvalidPermissionError => e
puts "Permission error: #{e.message}"
rescue Models::Errors::ValidationErrorResponse => e
puts "Validation error: #{e.message}"
rescue Errors::APIError => e
puts "API error: #{e.message}"
end
You can override the default server URL when initializing the SDK:
sdk = ::FastpixApiSDK::SDK.new(
server_url: 'https://api.fastpix.io/v1/live',
security: Models::Components::Security.new(
username: 'your-username',
password: 'your-password'
)
)
This SDK is currently in beta, and breaking changes may occur between versions even without a major version update. To avoid unexpected issues, we recommend pinning your dependency to a specific version. This ensures consistent behavior unless you intentionally update to a newer release.
For a complete understanding of each API's functionality, including request and response details, parameter descriptions, and additional examples, please refer to the FastPix API Reference.
The API reference provides comprehensive documentation for all available endpoints and features, ensuring developers can integrate and utilize FastPix APIs efficiently.
We welcome contributions from the community! If you're interested in contributing to the FastPix Ruby SDK, please follow these steps:
- Fork the repository
- Create a new branch for your feature or bug fix
- Make your changes and commit them
- Push your changes to your fork
- Create a pull request