---
title: "MediaHelpers - s&box library"
description: "A library used to retrieve video stream urls for use with the VideoPlayer class."
canonical: "https://sbox.watch/zh-cn/libraries/carsonk/mediahelpers/"
generated_at: "2026-11-27T15:18:25.301Z"
---

# MediaHelpers

A library used to retrieve video stream urls for use with the VideoPlayer class.

- 类型: 库
- 标识符: carsonk.mediahelpers
- 创作者: Carson Kompon
- 规范地址: https://sbox.watch/zh-cn/libraries/carsonk/mediahelpers/
- Markdown: https://sbox.watch/zh-cn/libraries/carsonk/mediahelpers/index.md
- sbox.game: https://sbox.game/carsonk/mediahelpers/
- 生成时间: 2026-11-27T15:18:25.301Z

## 统计

- 24小时热度: +0
- Terry 评分: 79%
- 收藏: 15
- 好评: 10
- 差评: 0
- 更新时间: 2023年8月26日
- 创建时间: 2023年6月15日
- 大小: 73.3 KB
- 文件: 7
- 标签: videoplayer, media, video, helper

## 描述

MediaHelpers
A library used to retrieve video stream urls for use with the VideoPlayer class.
How to use
Add the following package to your game/addon:

Make sure your class is and you're good to go!

Here's some example code:
public void PlayVideo(string url)
{
 if(MediaHelper.IsYoutubeUrl(url))
 {
 string streamUrl = MediaHelper.GetUrlFromYoutubeUrl(url);
 videoPlayer.Play(streamUrl);
 }
 else
 {
 videoPlayer.Play(url);
 }
}



## More by Carson Kompon

| Package | 标识符 | 玩家 | 收藏 | 好评 | 评分 | Markdown |
| --- | --- | --- | --- | --- | --- | --- |
| Razor Panel Tooltips | carsonk.razor_tooltips | 0 | 6 | 6 | 55% | https://sbox.watch/zh-cn/libraries/carsonk/razor_tooltips/index.md |
| RichText Razor Panels | carsonk.richtextpanels | 0 | 3 | 4 | 60% | https://sbox.watch/zh-cn/libraries/carsonk/richtextpanels/index.md |
| TikTokTTS | carsonk.tiktoktts | 0 | 1 | 4 | 60% | https://sbox.watch/zh-cn/libraries/carsonk/tiktoktts/index.md |
| SFXR | carsonk.sfxr | 0 | 1 | 2 | 43% | https://sbox.watch/zh-cn/libraries/carsonk/sfxr/index.md |
| Granular Pitch Audio Processor | carsonk.granularpitchprocessor | 0 | 1 | 0 | -- | https://sbox.watch/zh-cn/libraries/carsonk/granularpitchprocessor/index.md |
| Twitch API | carsonk.twitchapi | 0 | 0 | 0 | -- | https://sbox.watch/zh-cn/libraries/carsonk/twitchapi/index.md |
