• 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 BenouKat · Sep 10, 2012 at 09:18 AM · audioaudioclipstreamingsong

It is possible to start a streaming AudioClip not from the beginning ?

For exemple, i got a music in my HDD, i load it into streaming (because i need to), is there a way to start the song from 0:30 for example and not from the beginning, or says "go to 0:30" ?

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by skalev · Sep 11, 2012 at 03:48 AM

The documentation clearly states that AudioSource.timeSamples won't work with streaming clips. You have to load it into memory if you want to be able to use this feature. (I know, I wished this was different too).

EDIT - Was able to get this to work, please see comments.

Comment
Add comment · Show 10 · 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 BenouKat · Sep 11, 2012 at 03:30 PM 0
Share

Yep, i see that, but the question is : can be resolve this with an other way ? Is it possible ? Or is there absolutly NO way to do this ?

avatar image skalev · Sep 11, 2012 at 04:00 PM 0
Share

Not to the best of my knowledge. It open up a can of worms to allow such a thing, so I guess that is why it was designed this way.

What are you trying to achieve? you can potentially just cut up the files into smaller chunks and stream the parts you want, and manage the transitions between files manually.

avatar image Screenhog · Sep 12, 2012 at 05:18 PM 1
Share

What about making two strea$$anonymous$$g audio clips for each song? One strea$$anonymous$$g clip is the entire song, and the other is a section cut out from the song. Then just stream that one when someone wants to listen to the preview.

avatar image skalev · Sep 12, 2012 at 08:42 PM 1
Share

Ok. So I guess I was mistaken. I remembered seeing this before, but was unable to find the doc about it again. So I wrote a quick test, and found that it does actually work, meaning that you CAN skip ahead in the clip. Sorry for the wrong information, I can't for the life of me remember now where I saw it, but this actually helps me in my project too :)

Just to clarify, in order to get the clip to start at the position you want it too, set the timeSamples variable of the AudioSource BEFORE you call Play(). This will ensure it will start at the correct position.

avatar image skalev · Sep 13, 2012 at 06:54 PM 1
Share

I managed to get that to work. I think the trick is that you have to load enough of it before you skip forward. I was going to run a test today to see if I can query the file to make sure it loaded to the point I want to play... will keep you posted.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

11 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

Related Questions

Usage of DownloadHandlerAudioClip.streamAudio 1 Answer

A method for streaming custom audio from the hard drive 0 Answers

AudioClip "Stream from disc" does not work in standalone apps 0 Answers

How to have www streaming to work with a radio station? 1 Answer

How to avoid lag when using WWW class to download sound 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