小编Lor*_*öhr的帖子

AVPlayer - 向CMTime添加秒数

如何为当前的播放时间添加5秒?
其实这是我的代码:

CMTime currentTime = music.currentTime;
Run Code Online (Sandbox Code Playgroud)

我不能使用CMTimeGetSeconds(),因为我需要CMTime格式.

谢谢您的回答...

编辑:如何为CMTime设置变量?

iphone xcode ios avplayer cmtime

16
推荐指数
3
解决办法
2万
查看次数

将AVPlayer回放5秒

如何将流回放5秒?

这是我在viewDidLoad中的流媒体代码:

AVPlayerItem* playerItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://groove.wavestreamer.com:7321/listen.pls?sid=1"]];

[playerItem addObserver:self forKeyPath:@"timedMetadata" options:NSKeyValueObservingOptionNew context:nil];

music = [[AVPlayer playerWithPlayerItem:playerItem] retain];
[music play]; 

music = [[AVPlayer playerWithPlayerItem:playerItem] retain];
[music play];
Run Code Online (Sandbox Code Playgroud)

谢谢你的回答......

iphone stream ios avplayer

7
推荐指数
3
解决办法
4824
查看次数

AVPlayer音量控制

我想创建一个按钮来静音来自AVPlayer的音频.

为什么我不能将.volume与AVPlayer一起使用,只能使用AVAudioPlayer?还有另一种改变音量的方法吗?

例如 music.volume = 0.0;

谢谢你的回答.

iphone volume avaudioplayer avplayer

7
推荐指数
1
解决办法
1万
查看次数

AVPlayer-快速前进/后退流

这是我在viewDidLoad中的代码:

AVPlayerItem* playerItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://groove.wavestreamer.com:7321/listen.pls?sid=1"]];

[playerItem addObserver:self forKeyPath:@"timedMetadata" options:NSKeyValueObservingOptionNew context:nil];

music = [[AVPlayer playerWithPlayerItem:playerItem] retain];
[music play];
Run Code Online (Sandbox Code Playgroud)

我的问题:
如何创建一个按钮,在按下流时可以快进/快退5秒?

谢谢您的回答... :)

编辑:我如何添加到我的当前时间...

CMTime currentTime = music.currentTime;
Run Code Online (Sandbox Code Playgroud)

...这5秒?

iphone xcode forward ios avplayer

3
推荐指数
3
解决办法
6497
查看次数

UITextView - 水平滚动?

如何创建水平滚动UITextView?

当我以编程方式设置文本时,它会添加自动换行符,所以我只能垂直滚动...

 titleView.text = @"this is a very long text. this is a very long text. this is a very long text. this is a very long text. this is a very long text.";
Run Code Online (Sandbox Code Playgroud)

谢谢你的回答.

编辑:到目前为止我试过这个:

 UIScrollview *yourScrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0 ,0 ,       self.view.frame.size.width, 50)];
CGFloat textLength = [titleView.text sizeWithFont:titleView.font constrainedToSize:CGSizeMake(9999, 50) lineBreakMode:NSLineBreakByWordWrapping].width;

yourScrollview.contentSize = CGSizeMake(textLength + 200, 500); //or some value you like, you may have to try this out a few times

titleView.frame = CGRectMake(titleView.frame.origin.x, …
Run Code Online (Sandbox Code Playgroud)

iphone xcode horizontal-scrolling uitextview ios

3
推荐指数
1
解决办法
6160
查看次数