FSAudioController.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * This file is part of the FreeStreamer project,
  3. * (C)Copyright 2011-2013 Matias Muhonen.
  4. * See the file ''LICENSE'' for using the code.
  5. */
  6. #import <Foundation/Foundation.h>
  7. @class FSAudioStream;
  8. @class FSCheckContentTypeRequest;
  9. @class FSParsePlaylistRequest;
  10. @class FSParseRssPodcastFeedRequest;
  11. /**
  12. * FSAudioController is functionally equivalent to FSAudioStream with
  13. * one addition: it can be directly fed with a playlist (PLS, M3U) URL
  14. * or an RSS podcast feed. It determines the content type and forms
  15. * a playlist for playback.
  16. *
  17. * Do not use this class but FSAudioStream, if you already know the content type
  18. * of the URL. Using this class will generate more traffic, as the
  19. * content type is checked for each URL.
  20. */
  21. @interface FSAudioController : NSObject {
  22. NSString *_url;
  23. FSAudioStream *_audioStream;
  24. BOOL _readyToPlay;
  25. FSCheckContentTypeRequest *_checkContentTypeRequest;
  26. FSParsePlaylistRequest *_parsePlaylistRequest;
  27. FSParseRssPodcastFeedRequest *_parseRssPodcastFeedRequest;
  28. }
  29. /**
  30. * Initializes the audio stream with an URL.
  31. *
  32. * @param url The URL from which the stream data is retrieved.
  33. */
  34. - (id)initWithUrl:(NSString *)url;
  35. /**
  36. * Starts playing the stream. Before the playback starts,
  37. * the URL content type is checked and playlists resolved.
  38. */
  39. - (void)play;
  40. /**
  41. * Starts playing the stream from an URL. Before the playback starts,
  42. * the URL content type is checked and playlists resolved.
  43. *
  44. * @param url The URL from which the stream data is retrieved.
  45. */
  46. - (void)playFromURL:(NSString*)url;
  47. /**
  48. * Stops the stream playback.
  49. */
  50. - (void)stop;
  51. /**
  52. * If the stream is playing, the stream playback is paused upon calling pause.
  53. * Otherwise (the stream is paused), calling pause will continue the playback.
  54. */
  55. - (void)pause;
  56. /**
  57. * Returns the playback status: YES if the stream is playing, NO otherwise.
  58. */
  59. - (BOOL)isPlaying;
  60. /**
  61. * The stream URL.
  62. */
  63. @property (nonatomic,assign) NSString *url;
  64. /**
  65. * The audio stream.
  66. */
  67. @property (readonly) FSAudioStream *stream;
  68. @end