@@ -104,7 +104,12 @@ - (void)setCurPriMsg:(PrivateMessage *)curPriMsg andPrePriMsg:(PrivateMessage *)
104104 [self configSendStatus ];
105105 // refresh voice view play state
106106 if (_voiceView) {
107- [_voiceView setUrl: [NSURL fileURLWithPath: curPriMsg.voiceMedia.file]];
107+ if (curPriMsg.file ) {
108+ [_voiceView setUrl: [NSURL URLWithString: curPriMsg.file]];
109+ }
110+ else {
111+ [_voiceView setUrl: [NSURL fileURLWithPath: curPriMsg.voiceMedia.file]];
112+ }
108113 }
109114 return ;
110115 }else {
@@ -163,7 +168,7 @@ - (void)setCurPriMsg:(PrivateMessage *)curPriMsg andPrePriMsg:(PrivateMessage *)
163168
164169 bgImgViewSize = CGSizeMake (kMessageCell_ContentWidth +2 *kMessageCell_PadingWidth ,
165170 mediaViewHeight +textSize.height + kMessageCell_PadingHeight *(_curPriMsg.content .length > 0 ? 3 :2 ));
166- } else if (curPriMsg.voiceMedia ) {
171+ } else if (curPriMsg.file || curPriMsg. voiceMedia ) {
167172 bgImgViewSize = CGSizeMake (kMessageCell_ContentWidth , 40 );
168173 } else {
169174 [_contentLabel setY: kMessageCell_PadingHeight ];
@@ -172,8 +177,14 @@ - (void)setCurPriMsg:(PrivateMessage *)curPriMsg andPrePriMsg:(PrivateMessage *)
172177 }
173178
174179 if (_voiceView) {
175- [_voiceView setUrl: [NSURL fileURLWithPath: curPriMsg.voiceMedia.file]];
176- _voiceView.duration = curPriMsg.voiceMedia .duration ;
180+ if (curPriMsg.file ) {
181+ [_voiceView setUrl: [NSURL URLWithString: curPriMsg.file]];
182+ _voiceView.duration = curPriMsg.duration .doubleValue /1000 ;
183+ }
184+ else {
185+ [_voiceView setUrl: [NSURL fileURLWithPath: curPriMsg.voiceMedia.file]];
186+ _voiceView.duration = curPriMsg.voiceMedia .duration ;
187+ }
177188 _voiceView.playStartedBlock = ^(AudioPlayView *view) {
178189 BubblePlayView *bubbleView = (BubblePlayView *)view;
179190 if (bubbleView.isUnread ) {
@@ -273,7 +284,7 @@ + (CGFloat)cellHeightWithObj:(id)obj preObj:(id)preObj{
273284 CGSize textSize = [curPriMsg.content getSizeWithFont: kMessageCell_FontContent constrainedToSize: CGSizeMake (kMessageCell_ContentWidth , CGFLOAT_MAX)];
274285 CGFloat mediaViewHeight = [MessageCell mediaViewHeightWithObj: curPriMsg];
275286 cellHeight += mediaViewHeight;
276- if (curPriMsg.voiceMedia ) {
287+ if (curPriMsg.voiceMedia || curPriMsg. file ) {
277288 cellHeight += kMessageCell_PadingHeight *2 +40 ;
278289 } else {
279290 cellHeight += textSize.height + kMessageCell_PadingHeight *4 ;
0 commit comments