Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ForeignGod · Apr 25, 2014 at 05:06 PM · audiowwwurlyoutube

Download Audioclip from youtube URL with WWW

Hello, im currently trying to make a script where players can select their own music.

I made a script that works with .ogg links, but i cant seem to make youtube links works since unity does not recognize the audio source in the link.

Code:

 @script RequireComponent (AudioSource)
 
 var url = "https://www.youtube.com/watch?v=Og83qIIQsmw";
 
 var native_width : float = 1920;
 var native_height : float = 1080;
 
 function OnMouseDown () {
 var www : WWW = new WWW (url);  // start a download of the given URL
  
 audio.clip = www.GetAudioClip(false, true); // 2D, streaming
 }
 
 function Update() {
 
    if (!audio.isPlaying && audio.clip.isReadyToPlay)
 
         {
         audio.Play();
         }
     else
         {
         Debug.Log("waiting - isplaying : " + audio.isPlaying + " isreadyToPlay : " + audio.clip.isReadyToPlay);
 
         }
 }
 
 function OnGUI () {
 
     var rx : float = Screen.width / native_width;
     var ry : float = Screen.height / native_height;
         
     GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3 (rx, ry, 1)); 
  
     url = GUI.TextField (Rect (1300, 700, 300, 70), url, 100);
 
 }
 

Error Code:

Unable to determine the audio type from the URL (https://www.youtube.com/watch?v=Og83qIIQsmw) . Please specify the type. UnityEngine.WWW:GetAudioClip(Boolean, Boolean)

Im pretty sure i just can't download the Audiofile from a youtube link it self, but i need a direct link to the video instead. Does anyone know how to do that? Without making the players having to lots of stuff themselves, such as downloading then converting etc?

Im very new to WWW and usually just mess around with GUI and Physics. If there is any more information you need dont hesitate asking me.

Thanks in advance ^^

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Graham-Dunnett ♦♦ · Apr 25, 2014 at 09:55 PM 0
Share

WWW can't download random YouTube vids and play them back. WWW can fetch audio clips, but they need to be in a format that Unity understands, which, as the docs say, means Ogg or Wav. $$anonymous$$ovies must be in Ogg Theora format.

avatar image ForeignGod · Apr 25, 2014 at 10:42 PM 0
Share

I think i understood it so far, but is it a way to make the youtube link a direct link like common .ogg links. I just think it would be a hassle if players had to download the youtube video for themself, then convert it to ogg, then upload it to a webserver, then be able to use their link in-game. If there is no real way then i guess it'll just have to do. But i am pretty sure mp3 files are capable for playback, or maybe that is only on IOS.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by unity_GcNq3AitVEePDA · Jun 04, 2018 at 01:21 PM

I am Use Mp3xd online youtube converter website for using Download Any video on youtube. because it's fast, secure and easy to use.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by josephmiller · Jun 04, 2018 at 05:14 AM

All those who are fond of music must have heard about mp3converter.live because a number of users rely on this astonishing downloader to save their favorite media file. Follow this Step:-
1. Just paste your favorite youtube video URL. 2. Select Format. 3. Click the download button.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Maxence_Marchand · Jun 04, 2018 at 06:34 AM 0
Share

But isn't it quite illegal?

avatar image josephmiller Maxence_Marchand · Jun 04, 2018 at 11:20 AM 0
Share

No, It's not illegal. It's Fully legal.

avatar image Maxence_Marchand josephmiller · Jun 04, 2018 at 11:21 AM 0
Share

I see. I still wouldn't risk it, just to be sure.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to stream audio from a URL? 0 Answers

Stream audio from a YouTube playlist's URL? 0 Answers

WWW Audio and PlayOneShot: Playing the same AudioClip Twice Cuts off First Instance 1 Answer

How to get this .mp3 conversion script to play through an audio source? 0 Answers

Loading ogg though WWW results in 3D Sound, need as 2D... 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges