現在のプレイ時間に 5 秒を追加するにはどうすればよいですか?
実際、これは私のコードです:
CMTime currentTime = music.currentTime;
CMTime 形式が必要なため、 CMTimeGetSeconds() を使用できません。
ご回答ありがとうございます...
編集:CMTimeの変数を設定するにはどうすればよいですか?
1 つの方法を次に示します。
CMTimeMakeWithSeconds(CMTimeGetSeconds(music.currentTime) + 5, music.currentTime.timescale);
エレガントな使い方CMTimeAdd
CMTime currentTime = music.currentTime;
CMTime timeToAdd = CMTimeMakeWithSeconds(5,1);
CMTime resultTime = CMTimeAdd(currentTime,timeToAdd);
//then hopefully
[music seekToTime:resultTime];
あなたの編集に:これらの方法で CMTime 構造体を作成できます
CMTimeMake
CMTimeMakeFromDictionary
CMTimeMakeWithEpoch
CMTimeMakeWithSeconds