Requirements Description: The background provides functionality, you can upload the Youku video link address via the Rich text editor "Summernote" (note here: Youku Video provides a variety of ways to operate the following description, first make a mark);
The client is developed through Ionic, while the uploaded video view background source code; In fact, it is an IFRAME embed the tag; the question is, how does Ionic+angularjs parse the HTML code and put it on the client?
First Image:
The source of this image: http://www.thinksaas.cn/group/topic/350702/
Reference Figure II:
$scope. Myurl = URL; page:<iframe ng-src= ' {{myurl}} ' class= ' width-100 height-100 ' ></iframe> <iframe>//URL is full link ($sce. Trustasresourceurl ("http:/" + URL)) Trustasresourceurl is a way to prevent users from injecting URLs in Angularjs.
View Code
Figure II Source: Http://my.oschina.net/jack088/blog/390976?p=1
In fact, with these two references, the problem should be solved, "Ionic support iframe video embedding" but LZ encountered in the operation of the problem is not only these smashed doors continue to look down
First, let's take a look at Youku video.
There are three different forms and if you put it directly into the http://v.youku.com/v_show/id_XOTY0MzgwODgw.html?from=s1.8-1-1.2#paction address-- The operation of the corresponding Rich text editor is put into the open address of this video; Do you feel a bit around first don't worry LZ is so step by step around, why first show the above piece:
<iframe height=498 width=510 src= "HTTP://PLAYER.YOUKU.COM/EMBED/XOTY0MZGWODGW" frameborder=0 allowfullscreen> </iframe>
In fact, the last rich text to parse out is the above this iframe good finally came to the subject of the place;
varStrstart=mystring.indexof ("<iframe")-1; varStrend=mystring.indexof ("</iframe>")-2; varSS =mystring.substr (Strstart, strend); varstr = Ss.split (""); varurl = str[1].replace (' src= "//'," ")); Console.log (URL); $scope. Myvideourl= $sce. Trustasresourceurl ("http://" +url.substr (0,url.length-1)); Console.log ($scope. Myvideourl); $scope. Detailcontent= $scope. RESERVEDSTYTL (Mystring.replace (Mystring.substr (strstart,strend), "")); Console.log ($scope. detailcontent);
View Code
<iframe ng-src= "{{myvideourl}}" webkitallowfullscreen= "" mozallowfullscreen= "" allowfullscreen= "" Width= "100%" Frameborder= "0" height= "100%" ></iframe>
If there is a better way to solve welcome everyone downstairs message discussion! Progress together!
Ionic How to embed video iframe in mobile phone terminal