Skip to content
This repository has been archived by the owner on Sep 25, 2021. It is now read-only.

Commit

Permalink
Jssdk media. w7corp/easywechat#997
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Dec 8, 2017
1 parent a701768 commit 1c42a6e
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions zh-CN/basic-services/media.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,21 @@ $app->media->createVideoForBroadcasting($mediaId, $title, $description);

## 获取临时素材内容

比如图片、视频、声音等二进制流内容,响应为 `EasyWeChat\Kernel\Http\StreamResponse` 实例。
比如图片、语音等二进制流内容,响应为 `EasyWeChat\Kernel\Http\StreamResponse` 实例。

```php
$stream = $app->media->getStream($mediaId);
$stream = $app->media->get($mediaId);

// 以内容 md5 为文件名
// 以内容 md5 为文件名存到本地
$stream->save('保存目录');

// 自定义文件名,不需要带后缀
$stream->saveAs('保存目录', '文件名');
```

## 下载临时素材到本地

其实就是上一个 API 的封装。
## 获取 JSSDK 上传的高清语音

```php
$app->media->download($mediaId, "/tmp/", "abc.jpg");
```

参数说明:

- `$directory` 为目标目录,
- `$filename` 为新的文件名,可以为空,默认使用 `$mediaId` 作为文件名。
$stream = $app->media->getJssdkMedia($mediaId);
$stream->saveAs('保存目录', 'custom-name.speex');
```

0 comments on commit 1c42a6e

Please sign in to comment.