File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -382,6 +382,12 @@ AudioPlayerProvider::AudioFileInfo AudioPlayerProvider::getFileInfo(
382
382
FILE *fp = fopen (audioFilePath.c_str (), " rb" );
383
383
if (fp != nullptr ) {
384
384
fseek (fp, 0 , SEEK_END);
385
+ #if CC_PLATFORM == CC_PLATFORM_OPENHARMONY
386
+ int fd = fileno (fp);
387
+ if (fd > 0 ) {
388
+ assetFd = dup (fd);
389
+ }
390
+ #endif
385
391
fileSize = ftell (fp);
386
392
fclose (fp);
387
393
} else {
@@ -399,12 +405,6 @@ AudioPlayerProvider::AudioFileInfo AudioPlayerProvider::getFileInfo(
399
405
bool AudioPlayerProvider::isSmallFile (const AudioFileInfo &info) { // NOLINT(readability-convert-member-functions-to-static)
400
406
// REFINE: If file size is smaller than 100k, we think it's a small file. This value should be set by developers.
401
407
auto &audioFileInfo = const_cast <AudioFileInfo &>(info);
402
- #if CC_PLATFORM == CC_PLATFORM_OPENHARMONY
403
- if (audioFileInfo.url [0 ] == ' /' ) {
404
- // avplayer does not support playing audio files in sandbox path currently.
405
- return true ;
406
- }
407
- #endif
408
408
size_t judgeCount = sizeof (gAudioFileIndicator ) / sizeof (gAudioFileIndicator [0 ]);
409
409
size_t pos = audioFileInfo.url .rfind (' .' );
410
410
ccstd::string extension;
Original file line number Diff line number Diff line change @@ -312,7 +312,7 @@ void UrlAudioPlayer::destroy() {
312
312
if (!*_isDestroyed) {
313
313
*_isDestroyed = true ;
314
314
OH_AVErrCode code = OH_AVPlayer_Release (_playObj);
315
- if (code = = AV_ERR_OK) {
315
+ if (code ! = AV_ERR_OK) {
316
316
ALOGE (" UrlAudioPlayer release error, code: %d" , code);
317
317
}
318
318
}
You can’t perform that action at this time.
0 commit comments