Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to play a shoutcast stream #57

Open
thierryb opened this issue May 21, 2014 · 9 comments
Open

Unable to play a shoutcast stream #57

thierryb opened this issue May 21, 2014 · 9 comments

Comments

@thierryb
Copy link

Hi,

I am unable to play a shoutcast stream like goovesalad from somaFM.

http://ice.somafm.com/groovesalad

AVPlayer ask only for 1 byte then connection is stopped.

Do you have an idea?

Thanks

@hamzaozturk
Copy link

Hi thierryb,

It is a bug related to AVPlayer. If you first initialize an AVPlayer with a local file, then you can not play any shoutcast stream.

If you check HysteriaPlayer.m file, there is a method called playEmptySound. It initializes AVPlayer with a local file. If you change the method as below, then you can play any streaming content. But, at this time, you can not play any local media.

- (void)playEmptySound { self.isInEmptySound = YES; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://ice.somafm.com/groovesalad"]]; self.audioPlayer = [AVQueuePlayer queuePlayerWithItems:[NSArray arrayWithObject:playerItem]]; }

@saiday
Copy link
Member

saiday commented May 20, 2015

This is interesting, could you provide more shoutcast streams? Would like
to test it out.

hamzaozturk notifications@github.com 於 2015年5月21日 星期四寫道:

Hi thierryb,

It is a bug related to AVPlayer. If you first initialize an AVPlayer with
a local file, then you can not play any shoutcast stream.

If you check HysteriaPlayer.m file, there is a method called
playEmptySound. It initializes AVPlayer with a local file. If you change
the method as below, then you can play any streaming content. But, at this
time, you can not play any local media.

  • (void)playEmptySound { self.isInEmptySound = YES; AVPlayerItem
    *playerItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"
    http://ice.somafm.com/groovesalad"]]; self.audioPlayer =
    [AVQueuePlayer queuePlayerWithItems:[NSArray arrayWithObject:playerItem]]; }


Reply to this email directly or view it on GitHub
#57 (comment)
.

@hamzaozturk
Copy link

You can find here:
http://stackoverflow.com/questions/10104301/hls-streaming-video-url-need-for-testing

I have solved this problem as explained below:

If there is a transition from streaming content to local file or vice versa, I initialize the AVPlayer object again with the selected choice(local or remote).

@saiday saiday closed this as completed Dec 13, 2015
@hamzaozturk
Copy link

It still can not play the mixture of streaming and file-based media. If you think it is the solution what changed on ios9, it does not support for ios7 and ios8.

Ref: iOS 9 release note

AVQueuePlayer now supports a mixture of file-based media and HTTP Live Streaming media in its queue. Prior to this, you had to ensure that all items in the queue were of the same type.

@saiday
Copy link
Member

saiday commented Dec 14, 2015

Yes, I knew this AVQueuePlayer behaviour changed since iOS 9.
Sure, HysteriaPlayer had the chances to know the type of each input source, can initial new AVQueuePlayer when needs. I thought this implementation wouldn't change HysteriaPlayer API, and it's easier to use.

Thanks for your wise counsel. Reopen this issue.
Currently all my apps had no mixture of HTTP Live streaming and file-based media queue. I have no plans to support this feature in the primary now.

@saiday saiday reopened this Dec 14, 2015
@saiday
Copy link
Member

saiday commented Dec 31, 2015

There's a workaround if someone going to play HTTP Live Streaming, set skipEmptySoundPlaying to true before playing.

@tarzon
Copy link

tarzon commented Jun 21, 2016

Hi @saiday, I am facing the same issue. I am also unable to play mixture of local and streaming URLs. If I start playing with local urls, then it would play the local files, and then If I switch to stream URL, it would play it, but second time when I switch to local file Url, it would not play it. And then again if I roll back to stream URL, it wont play it either. This behaviour is permanent. Any help would be great.

@saiday
Copy link
Member

saiday commented Jun 21, 2016

@tarzon like what @hamzaozturk mentioned

AVQueuePlayer now supports a mixture of file-based media and HTTP Live Streaming media in its queue. Prior to this, you had to ensure that all items in the queue were of the same type

from iOS 9 release note:
https://developer.apple.com/library/prerelease/content/releasenotes/General/RN-iOSSDK-9.0/index.html

The best way to get rid of it is check audio resource type before player start playing, if you're going to play another type from previous resource, deprecate HysteriaPlayer by deprecatePlayer() and you will get a new instance next time you call HysteriaPlayer.sharedInstance().

@tarzon
Copy link

tarzon commented Jun 21, 2016

@saiday Thankyou. It worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants