/**Create a Player Instance.*/V2TXLivePlayer *player = [[V2TXLivePlayer alloc] init];/*** Set the video rendering View for the player. This control is responsible for displaying the video content.** @param view Player Rendering View* @return Return Value {@link V2TXLiveCode}* - V2TXLIVE_OK:Success*/[player setRenderView:view];/*** Set the player callback.** By setting the callback, you can listen to some callback events of the V2TXLivePlayer player,* This includes player status, playback volume callback, audio and video first frame callback, statistical data, warnings, and error information, etc.* @param observer The target object for the player's callback. For more information, please check {@link V2TXLivePlayerObserver}*/[player setObserver:self];/*** For key requests, please refer to License acquisition.* Set the Key** @note The URL in the JSON must be the same as the URL in startLivePlay. The SDK performs a second validation through the URL to avoid incorrect decryption caused by a mismatch between the key and the URL.*/NSString *url = @"http://5000.liveplay.myqcloud.com/live/flvtest100_1000.flv?request_type=STDFLV&TXEncryptionToken=ZW5jTW9kZT01JmVuY0tleT0yNmFjZWIxMjViNDczMWNjODRkZTAxZWEyNDA3ZDVmZCZlbmNJVj1iZmEwYmI0NDRhN2NhNDUyMDRjMmNhNzZhYWQyMWFjNA==";/*** Start playing the audio and video stream.** @param url The playback address of the audio and video stream, supporting RTMP, HTTP-FLV, TRTC,HLS。* @return Return Value {@link V2TXLiveCode}* - V2TXLIVE_OK: Operation successful, start connecting and playing* - V2TXLIVE_ERROR_INVALID_PARAMETER: Operation failed, the URL is not valid* - V2TXLIVE_ERROR_REFUSED: RTC does not support pushing and pulling the same StreamId on the same device at the same time.[player startLivePlay:url];
/*** Create a Player Instance.*/V2TXLivePlayer player = new V2TXLivePlayer();/*** Set the video rendering View for the player. This control is responsible for displaying the video content.** @param view Player rendering View* @return Return value {@link V2TXLiveCode}* - V2TXLIVE_OK:Success*/player.setRenderView(view);/*** Set the player callback.** By setting the callback, you can listen to some callback events of the V2TXLivePlayer player,* including player status, playback volume callback, audio and video first frame callback, statistical data, warnings, and error information, etc.** @param observer the callback target object of the player,For more information, please refer to {@link V2TXLivePlayerObserver}*/player.setObserver(this);/*** For key request, please refer to License acquisition* Set the key** @note The URL in the JSON must be the same as the URL in startLivePlay. The SDK performs a secondary verification through the URL to avoid the situation where the key and URL do not match, causing incorrect decryption.*/String url = "http://5000.liveplay.myqcloud.com/live/flvtest100_1000.flv?request_type=STDFLV&TXEncryptionToken=ZW5jTW9kZT01JmVuY0tleT0yNmFjZWIxMjViNDczMWNjODRkZTAxZWEyNDA3ZDVmZCZlbmNJVj1iZmEwYmI0NDRhN2NhNDUyMDRjMmNhNzZhYWQyMWFjNA==";/*** Start playing the audio and video stream.** @param url @param url The playback address of the audio and video stream, supporting RTMP, HTTP-FLV, TRTC, and HLS.* @return Return value {@link V2TXLiveCode}* - V2TXLIVE_OK: Operation succeeded, start connecting and playing* - V2TXLIVE_ERROR_INVALID_PARAMETER: Operation failed, the URL is not valid* - V2TXLIVE_ERROR_REFUSED: RTC does not support pushing and pulling the same StreamId on the same device at the same time.。*/player.startLivePlay(url);
POST / HTTP/1.1Host: drm.tencentcloudapi.comContent-Type: application/jsonX-TC-Action: DescribeDRMLicense<Public Request Parameters>{"DrmType":"NORMALAES","ContentId":"flvtest100","Tracks":["SD"],"ContentType":"LIVEVIDEO"}
{"Response": {"ContentId": "flvtest100","TXEncryptionToken": "ZW5jTW9kZT01JmVuY0tleT0yNmFjZWIxMjViNDczMWNjODRkZTAxZWEyNDA3ZDVmZCZlbmNJVj1iZmEwYmI0NDRhN2NhNDUyMDRjMmNhNzZhYWQyMWFjNA==","RequestId": "47f336fd-b05a-4192-b1f4-8f9d4c5f76f1"}}
Was this page helpful?